-
Notifications
You must be signed in to change notification settings - Fork 0
Use createOrUpdate
pattern for pod environment configmap
#191
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
base: main
Are you sure you want to change the base?
Conversation
aed02b4
to
fef8968
Compare
createOrUpdate
patterncreateOrUpdate
pattern for pod environment configmap
if err := r.ensureZalandoDependencies(ctx, instance); err != nil { | ||
r.recorder.Eventf(instance, "Warning", "Error", "failed to install operator: %v", err) | ||
return ctrl.Result{}, fmt.Errorf("error while ensuring Zalando dependencies: %w", err) | ||
if err := r.CreateOrUpdateOperator(ctx, instance); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I don't like the fact that we now always update the operator each time anything changes and that it will not be skipped if the operator is already installed.
Before this change, we once called this code when we initially created the namespace, and once on startup of the postgreslet. Now it will be called from the postgres_controller, meaning every time anything changes.
I would like this to stay as it was: Once on creation, once on startup and each time the backup-config
changes.
Porposal
- CreateOrUpdate stays the way it is (no check if it is already installed), CreateOrUpdatePodEnvironmentConfigMap will be exported
- The postgres_controller checks if the operator is already installed and skips CreateOrUpdate if it is already installed (just like before)
- The postgres_controller will no longer update the pod environment configmap
- On startup, CreateOrUpdateOperator will be called (as before)
- A new BackupConfigController will watch the backup-configs and update the PodEnvironmentConfigMaps if neccessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f1f755e
to
7e6183f
Compare
So that we can later migrate to idiomatic
controllerutil.CreateOrUpdate
or evencontrollerutil.CreateOrPatch
. Moreover, the logic related to the extended opeartor (zalando operator + pod environment configmap + sidecars configmap) is all shifted toOperatorManager
, not mixed inPostgresController
anymore.