From 2b7861c20349394e4abb041c4d14a58ccccfe57e Mon Sep 17 00:00:00 2001 From: Kristina Pathak Date: Fri, 18 Nov 2022 08:27:58 -0800 Subject: [PATCH] add headless label (#1088) --- pkg/collector/reconcile/service.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/collector/reconcile/service.go b/pkg/collector/reconcile/service.go index 86a84f2002..8bb8e85198 100644 --- a/pkg/collector/reconcile/service.go +++ b/pkg/collector/reconcile/service.go @@ -34,6 +34,12 @@ import ( "github.com/open-telemetry/opentelemetry-operator/pkg/targetallocator" ) +// headless label is to differentiate the headless service from the clusterIP service. +const ( + headlessLabel = "operator.opentelemetry.io/collector-headless-service" + headlessExists = "Exists" +) + // +kubebuilder:rbac:groups="",resources=services,verbs=get;list;watch;create;update;patch;delete // Services reconciles the service(s) required for the instance in the current context. @@ -154,6 +160,7 @@ func headless(ctx context.Context, params Params) *corev1.Service { } h.Name = naming.HeadlessService(params.Instance) + h.Labels[headlessLabel] = headlessExists // copy to avoid modifying params.Instance.Annotations annotations := map[string]string{