This is an automated email from the ASF dual-hosted git repository.

caigy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-operator.git


The following commit(s) were added to refs/heads/master by this push:
     new 9752d8c  [ISSUE #216] support console resource update (#217)
9752d8c is described below

commit 9752d8c2b5d65f23976e6268241c5b4551418e56
Author: yangw <[email protected]>
AuthorDate: Thu Mar 28 20:00:11 2024 +0800

    [ISSUE #216] support console resource update (#217)
---
 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 63c3fe3..9eb1e4c 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)
                }
        }
 

Reply via email to