From fd7299ebeb67454b13ed9930bf423e95af25f119 Mon Sep 17 00:00:00 2001 From: calvin Date: Wed, 9 Aug 2023 13:00:57 +0800 Subject: [PATCH] karmada operator: fixed karmada label beinging overwritten Signed-off-by: calvin --- operator/pkg/controller/karmada/controller.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/operator/pkg/controller/karmada/controller.go b/operator/pkg/controller/karmada/controller.go index 3cab3f43b9fb..22a5a7f24585 100644 --- a/operator/pkg/controller/karmada/controller.go +++ b/operator/pkg/controller/karmada/controller.go @@ -111,7 +111,8 @@ func (ctrl *Controller) ensureKarmada(ctx context.Context, karmada *operatorv1al // registering our finalizer. updated := controllerutil.AddFinalizer(karmada, ControllerFinalizerName) if _, isExist := karmada.Labels[DisableCascadingDeletionLabel]; !isExist { - karmada.SetLabels(labels.Set{DisableCascadingDeletionLabel: "false"}) + labelMap := labels.Merge(karmada.GetLabels(), labels.Set{DisableCascadingDeletionLabel: "false"}) + karmada.SetLabels(labelMap) updated = true }