From df7f007f71ff644b2d2d1d8af7cb61738094b649 Mon Sep 17 00:00:00 2001 From: zhzhuang-zju Date: Tue, 25 Feb 2025 19:48:25 +0800 Subject: [PATCH] operator: fix the issue that the default values of Karmada are not correctly applied Signed-off-by: zhzhuang-zju --- operator/pkg/controller/karmada/controller.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/operator/pkg/controller/karmada/controller.go b/operator/pkg/controller/karmada/controller.go index 4f057c452..5fd40e479 100644 --- a/operator/pkg/controller/karmada/controller.go +++ b/operator/pkg/controller/karmada/controller.go @@ -92,15 +92,15 @@ func (ctrl *Controller) Reconcile(ctx context.Context, req controllerruntime.Req return ctrl.removeFinalizer(ctx, karmada) } + if err := ctrl.updateKarmada(ctx, karmada); err != nil { + return controllerruntime.Result{}, err + } + if err := ctrl.validateKarmada(ctx, karmada); err != nil { klog.Errorf("Validation failed for karmada: %+v", err) return controllerruntime.Result{}, nil } - if err := ctrl.ensureKarmada(ctx, karmada); err != nil { - return controllerruntime.Result{}, err - } - return controllerruntime.Result{}, ctrl.syncKarmada(karmada) } @@ -129,7 +129,7 @@ func (ctrl *Controller) removeFinalizer(ctx context.Context, karmada *operatorv1 }) } -func (ctrl *Controller) ensureKarmada(ctx context.Context, karmada *operatorv1alpha1.Karmada) error { +func (ctrl *Controller) updateKarmada(ctx context.Context, karmada *operatorv1alpha1.Karmada) error { // The object is not being deleted, so if it does not have our finalizer, // then lets add the finalizer and update the object. This is equivalent // registering our finalizer.