Browse Source

clusterwide labels agreement

pull/4/head
Vladimir Smagin 1 year ago
parent
commit
5abfa64667
2 changed files with 15 additions and 16 deletions
  1. +4
    -4
      pkg/controller/rabbitmq/rabbitmq_controller.go
  2. +11
    -12
      pkg/controller/rabbitmq/rabbitmq_services.go

+ 4
- 4
pkg/controller/rabbitmq/rabbitmq_controller.go View File

@@ -140,8 +140,8 @@ func mergeMaps(itermaps ...map[string]string) map[string]string {

func returnLabels(cr *rabbitmqv1.Rabbitmq) map[string]string {
labels := map[string]string{
"rabbitmq.improvado.io/app": "rabbitmq",
"rabbitmq.improvado.io/name": cr.Name,
"application": "rabbitmq",
"instance": cr.Name,
}
return labels
}
@@ -390,7 +390,7 @@ func newStatefulSet(cr *rabbitmqv1.Rabbitmq, secretNames secretResouces) *v1.Sta
podTemplate := corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: mergeMaps(returnLabels(cr),
map[string]string{"rabbitmq.improvado.io/component": "messaging"},
map[string]string{"component": "messaging"},
),
Annotations: returnAnnotations(cr),
},
@@ -458,7 +458,7 @@ func newStatefulSet(cr *rabbitmqv1.Rabbitmq, secretNames secretResouces) *v1.Sta
Name: cr.Name,
Namespace: cr.Namespace,
Labels: mergeMaps(returnLabels(cr),
map[string]string{"rabbitmq.improvado.io/component": "messaging"},
map[string]string{"component": "messaging"},
),
},
Spec: v1.StatefulSetSpec{


+ 11
- 12
pkg/controller/rabbitmq/rabbitmq_services.go View File

@@ -92,8 +92,8 @@ func (r *ReconcileRabbitmq) reconcileDiscoveryService(reqLogger logr.Logger, cr
Name: cr.Name + "-discovery",
Namespace: cr.Namespace,
Labels: mergeMaps(returnLabels(cr),
map[string]string{"rabbitmq.improvado.io/service": "discovery"},
map[string]string{"rabbitmq.improvado.io/component": "networking"},
map[string]string{"service": "discovery"},
map[string]string{"component": "networking"},
),
},
Spec: corev1.ServiceSpec{
@@ -127,8 +127,8 @@ func (r *ReconcileRabbitmq) reconcileHAService(reqLogger logr.Logger, cr *rabbit
Name: cr.Name,
Namespace: cr.Namespace,
Labels: mergeMaps(returnLabels(cr),
map[string]string{"rabbitmq.improvado.io/service": "general"},
map[string]string{"rabbitmq.improvado.io/component": "networking"},
map[string]string{"service": "general"},
map[string]string{"component": "networking"},
),
},
Spec: corev1.ServiceSpec{
@@ -169,8 +169,8 @@ func (r *ReconcileRabbitmq) reconcileHTTPService(reqLogger logr.Logger, cr *rabb
Name: cr.Name + "-api",
Namespace: cr.Namespace,
Labels: mergeMaps(returnLabels(cr),
map[string]string{"rabbitmq.improvado.io/service": "api"},
map[string]string{"rabbitmq.improvado.io/component": "networking"},
map[string]string{"service": "api"},
map[string]string{"component": "networking"},
),
},
Spec: corev1.ServiceSpec{
@@ -199,9 +199,9 @@ func (r *ReconcileRabbitmq) reconcilePrometheusExporterService(reqLogger logr.Lo
Name: cr.Name + "-exporter",
Namespace: cr.Namespace,
Labels: mergeMaps(returnLabels(cr),
map[string]string{"rabbitmq.improvado.io/service": "prometheus-exporter"},
map[string]string{"rabbitmq.improvado.io/component": "monitoring"},
map[string]string{"rabbitmq.improvado.io/component": "networking"},
map[string]string{"service": "prometheus-exporter"},
map[string]string{"component": "monitoring"},
map[string]string{"component": "networking"},
),
},
Spec: corev1.ServiceSpec{
@@ -234,9 +234,8 @@ func (r *ReconcileRabbitmq) reconcilePrometheusExporterServiceMonitor(reqLogger
Spec: v12.ServiceMonitorSpec{
Selector: metav1.LabelSelector{
MatchLabels: mergeMaps(returnLabels(cr),
map[string]string{"rabbitmq.improvado.io/service": "prometheus-exporter"},
map[string]string{"rabbitmq.improvado.io/component": "monitoring"},
map[string]string{"rabbitmq.improvado.io/component": "networking"},
map[string]string{"service": "prometheus-exporter"},
map[string]string{"component": "monitoring"},
),
},
Endpoints: []v12.Endpoint{


Loading…
Cancel
Save