postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

fix(2582): added cluster level delete secrets config

Open Yingrjimsch opened this issue 1 year ago • 1 comments

Here #2582 it has been discussed to add a config for deleting secrets globally on operator level. This is very nice and helps greatly.

In my case I have a setup where my operator contains the config delete_annotation_name_key: delete-clustername and as a safety config enable_secrets_deletion: false which is needed if I want to clear a postgres cluster completely but still need the secrets. This works like a charm but I have temporary walg cluster clones which can be applied to get some backups. This temporary walg clones should still delete their secrets post deletion therefore a config is needed on cluster level. I implemented the config enable_secrets_deletion_key in a similar way as delete_annotation_name_key works. This allows me to override the operator wide enable_secrets_deletion configuratin per postgresql cluster. If it is not set, the operator decides whether the secrets should be deleted, if it is set to true the secrets are deleted nevertheless and if it is set to false the secrets will not be deleted, allowing for a more fine granular configuration.

I have checked several possible scenarios with the following results:

enable_secrets_deletion delete_annotation_name_key delete-clustername enable-secrets-deletion Keep Secrets?
- - - - NO
true - - - NO
false - - - YES
- delete-clustername acid-minimal-cluster - NO
- delete-clustername - - YES
true delete-clustername - - YES
false delete-clustername - - YES
true delete-clustername - true YES
false delete-clustername - false YES
true delete-clustername acid-minimal-cluster - NO
false delete-clustername acid-minimal-cluster - YES
true delete-clustername acid-minimal-cluster true NO
false delete-clustername acid-minimal-cluster false YES

@dmotte can you review this please?

Yingrjimsch avatar Sep 05 '24 13:09 Yingrjimsch

@FxKu could you please review this "small" fix? I would really appreciate it 😄

Yingrjimsch avatar Oct 10 '24 07:10 Yingrjimsch

I haven't checked yet, if the option works vice versa, but this would be my preferred implementation. So that you can have: a. global config to drop secrets on cluster deletion, keep for single clusters which use the ignore annotation == "true" b. global config to keep secrets on cluster deletion, drop for single clusters which use the ignore annotation == "true"

Therefore, I think naming this option "ignore..." is more suitable and easier to understand.

FxKu avatar Dec 19 '24 11:12 FxKu