remove observedGeneration from postgresDatabase#1812
remove observedGeneration from postgresDatabase#1812DmytroPI-dev wants to merge 7 commits intofeature/database-controllersfrom
Conversation
| predicate.GenerationChangedPredicate{}, | ||
| predicate.Funcs{ | ||
| UpdateFunc: func(e event.UpdateEvent) bool { | ||
| oldObj, okOld := e.ObjectOld.(*cnpgv1.Database) |
There was a problem hiding this comment.
whats the difference between this predicate and GenerationChangedPredicate?
There was a problem hiding this comment.
If my understanding is correct, GenerationChangedPredicate is triggered only when CNPG Database spec changes. If we have status-only update, generation might not always change. Owner reference changes on the owned CNPG Database would also stop triggering reconciliation.
There was a problem hiding this comment.
but then if you expect object to be triggered with every change including status, cant we simply remove predicate and react to every trigger? What events we filter out right now?
There was a problem hiding this comment.
As we update status at least in three places, (414, 97, 627), and this custom predicate triggers reconcile in cases when deletion starts, finalizers changes, and ignore other update-only metadata/status changes. We filter out condition-only updates, like ClusterReady, SecretsReady, ConfigMapsReady, RolesReady, etc. This was one of the sources of reconciliation storm we were struggling.
0b9acab to
c333f1e
Compare
|
apart from the logging and some other nits (which ofc should be addressed) there is a nice structure seen -> reconcile flow rework -> tests expanded accordingly to catch the change and validate It. I like that |
f3c1063 to
4b7006f
Compare
Description
This PR aligns
PostgresDatabasewith the watch-driven reconciliation approach used forPostgresCluster. It removes the reconcile skip based onObservedGeneration, reacts to ownedSecret/ConfigMapdrift even when the spec is unchanged, repairs configmap drift declaratively, and degrades status instead of recreating previously provisioned managed secrets that were deleted.Key Changes
postgresdatabase_controller.goadd explicit drift-trigger predicates for ownedSecret,ConfigMap, and relevant CNPGDatabasechanges. Conflict retries are requeued without surfacing noisy reconcile errors.database.goremove theObservedGenerationshort-circuit and revalidated stages on every reconcile. Add drift handling for managed user secrets, configmap repair/re-adoption, retained-resource adoption, conflict-friendly database reconcile handling, and quieter ready/not-found paths.events.goAdd events for drift and retained-resource adoption.cluster.goreduced log noise on transient status-update conflicts.Testing and Verification
postgresdatabase_controller_test.gofor:database_unit_test.gofor secret/configmap drift and adoption paths.DeleteandRetainpolicies.Related Issues
CPI-1950
PR Checklist