diff --git a/api/v1beta2/kyma_types.go b/api/v1beta2/kyma_types.go index 677b195c23..ef50f8e2f8 100644 --- a/api/v1beta2/kyma_types.go +++ b/api/v1beta2/kyma_types.go @@ -435,7 +435,7 @@ func (kyma *Kyma) EnsureLabelsAndFinalizers() bool { } if _, ok := kyma.ObjectMeta.Labels[shared.ManagedBy]; !ok { - kyma.ObjectMeta.Labels[shared.ManagedBy] = shared.KymaLabelValue + kyma.ObjectMeta.Labels[shared.ManagedBy] = shared.OperatorName updateRequired = true } return updateRequired diff --git a/pkg/module/common/module.go b/pkg/module/common/module.go index 39e63f3b22..f7c0baa137 100644 --- a/pkg/module/common/module.go +++ b/pkg/module/common/module.go @@ -46,7 +46,7 @@ func (m *Module) ApplyDefaultMetaToManifest(kyma *v1beta2.Kyma) { } lbls[shared.ModuleName] = m.ModuleName lbls[shared.ChannelLabel] = m.Template.Spec.Channel - lbls[shared.ManagedBy] = shared.KymaLabelValue + lbls[shared.ManagedBy] = shared.OperatorName if m.Template.Spec.Mandatory { lbls[shared.IsMandatoryModule] = shared.EnableLabelValue } diff --git a/pkg/module/common/module_test.go b/pkg/module/common/module_test.go index e7c6b767ca..d9c91d97a8 100644 --- a/pkg/module/common/module_test.go +++ b/pkg/module/common/module_test.go @@ -72,7 +72,7 @@ func TestApplyDefaultMetaToManifest_WhenCalled_SetsManagedByLabel(t *testing.T) module.ApplyDefaultMetaToManifest(kyma) resultLabels := module.GetLabels() - assert.Equal(t, "kyma", resultLabels["operator.kyma-project.io/managed-by"]) + assert.Equal(t, "lifecycle-manager", resultLabels["operator.kyma-project.io/managed-by"]) } func TestApplyDefaultMetaToManifest_WhenCalled_SetsFQDNAnnotation(t *testing.T) { diff --git a/pkg/testutils/builder/watcher.go b/pkg/testutils/builder/watcher.go index 6f3167c922..20c4cb696b 100644 --- a/pkg/testutils/builder/watcher.go +++ b/pkg/testutils/builder/watcher.go @@ -17,16 +17,13 @@ func NewWatcherBuilder() *WatcherBuilder { builder := &WatcherBuilder{ watcher: &v1beta2.Watcher{}, } - builder.watcher.SetLabels( - map[string]string{ - shared.ManagedBy: shared.KymaLabelValue, - }) namespace := random.Name() return builder. WithName(random.Name()). WithNamespace(namespace). + WithManager(random.Name()). WithServiceInfoName(random.Name()). WithServiceInfoNamespace(namespace). WithServiceInfoPort(random.Port()). @@ -49,6 +46,13 @@ func (builder *WatcherBuilder) WithNamespace(namespace string) *WatcherBuilder { return builder } +func (builder *WatcherBuilder) WithManager(manager string) *WatcherBuilder { + builder.watcher.Labels = map[string]string{ + shared.ManagedBy: manager, + } + return builder +} + func (builder *WatcherBuilder) WithServiceInfoName(name string) *WatcherBuilder { builder.watcher.Spec.ServiceInfo.Name = name return builder diff --git a/pkg/testutils/utils.go b/pkg/testutils/utils.go index fc632f4724..076a3ea265 100644 --- a/pkg/testutils/utils.go +++ b/pkg/testutils/utils.go @@ -64,7 +64,7 @@ func NewTestIssuer(namespace string) *certmanagerv1.Issuer { Namespace: namespace, Labels: k8slabels.Set{ shared.PurposeLabel: shared.CertManager, - shared.ManagedBy: shared.KymaLabelValue, + shared.ManagedBy: shared.OperatorName, }, }, Spec: certmanagerv1.IssuerSpec{ diff --git a/pkg/watch/mandatory_template_change.go b/pkg/watch/mandatory_template_change.go index f264f210f6..aad0e37806 100644 --- a/pkg/watch/mandatory_template_change.go +++ b/pkg/watch/mandatory_template_change.go @@ -46,7 +46,7 @@ func (h *MandatoryTemplateChangeHandler) Watch() handler.MapFunc { func getKymaList(ctx context.Context, clnt client.Reader) (*v1beta2.KymaList, error) { kymas := &v1beta2.KymaList{} listOptions := &client.ListOptions{ - LabelSelector: k8slabels.SelectorFromSet(k8slabels.Set{shared.ManagedBy: shared.KymaLabelValue}), + LabelSelector: k8slabels.SelectorFromSet(k8slabels.Set{shared.ManagedBy: shared.OperatorName}), } err := clnt.List(ctx, kymas, listOptions) if err != nil { diff --git a/pkg/watcher/certificate_manager.go b/pkg/watcher/certificate_manager.go index 7d9336bb7b..9982e03fbb 100644 --- a/pkg/watcher/certificate_manager.go +++ b/pkg/watcher/certificate_manager.go @@ -86,7 +86,7 @@ func NewCertificateManager(kcpClient client.Client, kymaName string, caCertCache: caCertCache, labelSet: k8slabels.Set{ shared.PurposeLabel: shared.CertManager, - shared.ManagedBy: shared.KymaLabelValue, + shared.ManagedBy: shared.OperatorName, }, } } diff --git a/tests/integration/controller/mandatorymodule/deletion/controller_test.go b/tests/integration/controller/mandatorymodule/deletion/controller_test.go index 1ccd32396c..963631482a 100644 --- a/tests/integration/controller/mandatorymodule/deletion/controller_test.go +++ b/tests/integration/controller/mandatorymodule/deletion/controller_test.go @@ -21,7 +21,6 @@ import ( . "github.com/onsi/gomega" ) -// TEST var ErrNoMandatoryManifest = errors.New("manifest for mandatory Module not found") const ( @@ -93,7 +92,7 @@ func registerControlPlaneLifecycleForKyma(kyma *v1beta2.Kyma) { WithContext(ctx). WithArguments(kcpClient, template).Should(Succeed()) // Set labels and state manual, since we do not start the Kyma Controller - kyma.Labels[shared.ManagedBy] = shared.KymaLabelValue + kyma.Labels[shared.ManagedBy] = shared.OperatorName Eventually(CreateCR). WithContext(ctx). WithArguments(kcpClient, kyma).Should(Succeed()) diff --git a/tests/integration/controller/mandatorymodule/installation/controller_test.go b/tests/integration/controller/mandatorymodule/installation/controller_test.go index 6c3a9bec25..2a8343271c 100644 --- a/tests/integration/controller/mandatorymodule/installation/controller_test.go +++ b/tests/integration/controller/mandatorymodule/installation/controller_test.go @@ -88,7 +88,7 @@ func registerControlPlaneLifecycleForKyma(kyma *v1beta2.Kyma) { WithContext(ctx). WithArguments(kcpClient, template).Should(Succeed()) // Set labels and state manual, since we do not start the Kyma Controller - kyma.Labels[shared.ManagedBy] = shared.KymaLabelValue + kyma.Labels[shared.ManagedBy] = shared.OperatorName Eventually(CreateCR). WithContext(ctx). WithArguments(kcpClient, kyma).Should(Succeed()) diff --git a/tests/integration/controller/withwatcher/watcher_controller_helper_test.go b/tests/integration/controller/withwatcher/watcher_controller_helper_test.go index 72448e6732..1df37be625 100644 --- a/tests/integration/controller/withwatcher/watcher_controller_helper_test.go +++ b/tests/integration/controller/withwatcher/watcher_controller_helper_test.go @@ -143,7 +143,7 @@ func createCaCertificate() *certmanagerv1.Certificate { SecretName: "klm-watcher-root-secret", SecretTemplate: &certmanagerv1.CertificateSecretTemplate{ Labels: map[string]string{ - shared.ManagedBy: shared.KymaLabelValue, + shared.ManagedBy: shared.OperatorName, }, }, PrivateKey: &certmanagerv1.CertificatePrivateKey{ @@ -167,7 +167,7 @@ func createWatcherCR(managerInstanceName string, statusOnly bool) *v1beta2.Watch Name: managerInstanceName, Namespace: kcpSystemNs, Labels: map[string]string{ - shared.ManagedBy: shared.KymaLabelValue, + shared.ManagedBy: shared.OperatorName, }, }, Spec: v1beta2.WatcherSpec{ @@ -198,7 +198,7 @@ func createTLSSecret(kymaObjKey client.ObjectKey) *apicorev1.Secret { Name: watcher.ResolveTLSCertName(kymaObjKey.Name), Namespace: istioSystemNs, Labels: map[string]string{ - shared.ManagedBy: shared.KymaLabelValue, + shared.ManagedBy: shared.OperatorName, }, }, Data: map[string][]byte{