Skip to content

Commit

Permalink
[ISSUE #216] support console resource update (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
drivebyer authored Mar 28, 2024
1 parent 0ccad32 commit 9752d8c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/controller/console/console_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 9752d8c

Please sign in to comment.