diff --git a/pkg/constant/labels.go b/pkg/constant/labels.go index d4ae2d50bbda..8fee18e22c4e 100644 --- a/pkg/constant/labels.go +++ b/pkg/constant/labels.go @@ -99,6 +99,13 @@ func GetClusterWellKnownLabels(clusterName string) map[string]string { } } +// GetKBKnownLabels returns the kb-known labels for the headless svc +func GetKBKnownLabels() map[string]string { + return map[string]string{ + AppManagedByLabelKey: AppName, + } +} + // GetComponentWellKnownLabels returns the well-known labels for Component API func GetComponentWellKnownLabels(clusterName, componentName string) map[string]string { return map[string]string{ diff --git a/pkg/controller/instanceset/object_builder.go b/pkg/controller/instanceset/object_builder.go index 097f5835f7a8..b1bd1fa2ce2d 100644 --- a/pkg/controller/instanceset/object_builder.go +++ b/pkg/controller/instanceset/object_builder.go @@ -54,6 +54,7 @@ func buildHeadlessSvc(its workloads.InstanceSet, labels, selectors map[string]st annotations := ParseAnnotationsOfScope(HeadlessServiceScope, its.Annotations) hdlBuilder := builder.NewHeadlessServiceBuilder(its.Namespace, getHeadlessSvcName(its.Name)). AddLabelsInMap(labels). + AddLabelsInMap(constant.GetKBKnownLabels()). AddSelectorsInMap(selectors). AddAnnotationsInMap(annotations). SetPublishNotReadyAddresses(true)