Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

use correct port name in service monitor #33

Merged
merged 1 commit into from
Jun 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions controllers/etcdcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (

const (
clusterNameSpecField = "spec.clusterName"
etcdClientPortName = "etcd-client"
)

// EtcdClusterReconciler reconciles a EtcdCluster object
Expand Down Expand Up @@ -357,7 +358,7 @@ func headlessServiceForCluster(cluster *etcdv1alpha1.EtcdCluster) *v1.Service {
},
Ports: []v1.ServicePort{
{
Name: "etcd-client",
Name: etcdClientPortName,
Protocol: "TCP",
Port: etcdClientPort,
},
Expand Down Expand Up @@ -520,7 +521,7 @@ func serviceMonitorForCluster(cluster *etcdv1alpha1.EtcdCluster) *monitorv1.Serv
Spec: monitorv1.ServiceMonitorSpec{
Endpoints: []monitorv1.Endpoint{
{
Port: fmt.Sprintf("%d", etcdClientPort),
Port: etcdClientPortName,
Interval: "10s",
}},
NamespaceSelector: monitorv1.NamespaceSelector{
Expand Down Expand Up @@ -757,7 +758,7 @@ func (r *EtcdClusterReconciler) reconcile(
if err != nil {
return result, nil, fmt.Errorf("unable to create service monitor: %w", err)
}
log.V(1).Info("Created ServiceMonitor", "service_monitor", smCreatedEvent.ServiceMonitorName)
log.Info("Created ServiceMonitor", "service_monitor", smCreatedEvent.ServiceMonitorName)
return result, smCreatedEvent, nil
}

Expand Down