From 44eb406384ec0d91a4c9886c926af591dc8cd4ff Mon Sep 17 00:00:00 2001 From: drivebyer Date: Tue, 19 Mar 2024 15:41:48 +0800 Subject: [PATCH] [ISSUE #216] support console resource update --- pkg/controller/console/console_controller.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/controller/console/console_controller.go b/pkg/controller/console/console_controller.go index 63c3fe30..9eb1e4c6 100644 --- a/pkg/controller/console/console_controller.go +++ b/pkg/controller/console/console_controller.go @@ -161,14 +161,17 @@ func (r *ReconcileConsole) Reconcile(ctx context.Context, request reconcile.Requ return reconcile.Result{}, err } - // Support console deployment scaling - if !reflect.DeepEqual(instance.Spec.ConsoleDeployment.Spec.Replicas, found.Spec.Replicas) { + // Support console deployment update + if !reflect.DeepEqual(instance.Spec.ConsoleDeployment.Spec.Replicas, found.Spec.Replicas) || + !reflect.DeepEqual(instance.Spec.ConsoleDeployment.Spec.Template.Spec.Containers[0].Resources, found.Spec.Template.Spec.Containers[0].Resources) { + found.Spec.Replicas = instance.Spec.ConsoleDeployment.Spec.Replicas + found.Spec.Template.Spec.Containers[0].Resources = instance.Spec.ConsoleDeployment.Spec.Template.Spec.Containers[0].Resources err = r.client.Update(context.TODO(), found) if err != nil { - reqLogger.Error(err, "Failed to update console CR ", "Namespace", found.Namespace, "Name", found.Name) + reqLogger.Error(err, "Failed to update console CR", "Namespace", found.Namespace, "Name", found.Name) } else { - reqLogger.Info("Successfully updated console CR ", "Namespace", found.Namespace, "Name", found.Name) + reqLogger.Info("Successfully updated console CR", "Namespace", found.Namespace, "Name", found.Name) } }