Secret adoption is about ensuring that secrets related to the CRD are deleted when the CRD is deleted.
There are two possible implementation:
Set ownership to the secrets
Use a finalizer
The secrets that will be used by the AmaltheaSession being created outside of the scope of this operator, setting their ownership at CRD creation time is not guaranteed to succeed as the objects might not exist yet.
Hence while the former is simpler as it gives the burden of erasing to the API server, it would require several checks to ensure all secrets are properly owned.
The latter puts the burden on the controller however it allows for the secret to appear at a later time without requiring constant checks.
Edit: Following conversation, the finalizer solution will be used.
Secret adoption is about ensuring that secrets related to the CRD are deleted when the CRD is deleted.
There are two possible implementation:
The secrets that will be used by the AmaltheaSession being created outside of the scope of this operator, setting their ownership at CRD creation time is not guaranteed to succeed as the objects might not exist yet.
Hence while the former is simpler as it gives the burden of erasing to the API server, it would require several checks to ensure all secrets are properly owned.
The latter puts the burden on the controller however it allows for the secret to appear at a later time without requiring constant checks.
Edit: Following conversation, the finalizer solution will be used.