Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #216] support console resource update #217

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading