Conversation
…parison fails Signed-off-by: AGejr <albert.gejr@gmail.com>
|
Could you please also fix #443? 🙏 |
|
Sure, no problem. Should I open a new pr or add the documentation alongside the changes in this pr? |
|
Just add it in this same PR, I realized all sort of doc was missing while reviewing it (my fault) |
…covery Signed-off-by: AGejr <albert.gejr@gmail.com>
…tation, and restore Signed-off-by: AGejr <albert.gejr@gmail.com>
9c86233 to
5370c61
Compare
|
Pushed the docs and tests. #443: e2e:
On |
…s on restore Covers issue crossplane-contrib#441 end to end: recreate a Role with an empty status while the DB role survives, an Update that fails after ALTER ROLE PASSWORD, trigger rotation, a no-op reconcile and delete. Logins run inside the postgres pod through the Service, because the e2e port-forward arrives as loopback and pg_hba trusts it without a password. Two informational probes: an extra rotation right after the recreate (seen once) and a future-dated trigger rotating on every reconcile. Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>
…s on restore Covers issue crossplane-contrib#441 end to end: recreate a Role with an empty status while the DB role survives, an Update that fails after ALTER ROLE PASSWORD, trigger rotation, a no-op reconcile and delete. Logins run inside the postgres pod through the Service, because the e2e port-forward arrives as loopback and pg_hba trusts it without a password. Two informational probes: an extra rotation right after the recreate (seen once) and a future-dated trigger rotating on every reconcile. Signed-off-by: Carl Henrik Lunde <chlunde@ifi.uio.no>
|
Thanks for running this through your e2e harness @chlunde, both probes are real and I'd like to address them here. Future-dated Proposal: record the trigger the provider last acted on in Double rotation on recreate - agree it looks like informer cache lag: the status write recording Will push both fixes once we've settled on the approach. |
Description of your changes
Fixes a bug in the password auto-rotation feature where
Update()on aRolecan regenerate and apply a new password in Postgres, then lose it permanently if a later step in the same call fails.changedPrivsnow applies the full desired privilege list instead of erroring when the observed clause list is shorter than desired (this happens whenever the role's.statushasn't been observed yet, e.g. right after a restore)Updateno longer recordsLastPasswordChangeuntil every step has succeeded, so a later failure can't strand a password that was changed in Postgres but never recorded or publishedBoth fixes are mirrored in the cluster-scoped and namespaced
Rolereconcilers.Also documents the Postgres
Rolepassword mechanism, which was previously undocumented: a newdocs/postgresql-role-passwords.mdcovering BYO vs auto-generated passwords, generation parameters, recovery of a lost password, and rotation viapasswordRotationTrigger(including the caveat that the trigger is inert untillastPasswordChangeis first set). Field godoc onpasswordSecretRefandpasswordRotationTriggeris expanded in both API groups and links to the new page, and theRoleexamples gainrotating-roleandbyo-password-role.Fixes #441
Fixes #443
I have:
make reviewableto ensure this PR is ready for review.How has this code been tested
Updated unit tests cover the
changedPrivsbehavior change (applying the full desired set instead of erroring). The postgres e2e suite (cluster/local/postgresdb_functions.sh) gains coverage for theRolepassword mechanism in both the cluster and namespaced trees: BYO password publish and update propagation, auto-generated password recovery when the connection secret is lost, rotation viapasswordRotationTrigger, and password recovery when theRoleobject is deleted and recreated while the database role persists. Full suite passes withgo test ./....