[RDS Controller] can't remove deletion protection
- instantiate DB with FluxCD from typical manifest with
deletionProtection: true - wait till DB would be created
- remove DB from FluxCD control repo
- the DB won't be removed from the cluster because
deletionProtection: trueso we have discrepancy between gitrepo and the actual state - The DB WOULD NEVER removed even if I would try to manually patch the
deletionProtection: false
https://github.com/user-attachments/assets/d2fd1c22-0654-4352-95f5-f08fa64c467d
Hello @gecube 👋 Thank you for opening an issue in ACK! A maintainer will triage this issue soon.
We encourage community contributions, so if you're interested in tackling this yourself or suggesting a solution, please check out our Contribution and Code of Conduct guidelines.
You can find more information about ACK on our website.
I was able to remove database when following the next steps:
- remove removal protection from the Amazon UI
- then instantly patch the object in k8s to
deletionProtection: false - and then the DB was removed
also I checked that the removal of deletion protection on RDS does not help, it should be followed by changing the flag to deletionProtection: false
Issues go stale after 180d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 60d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle stale
/remove-lifecycle stale
Hey @gecube,
Thanks for reporting this issue. You've identified a deadlock in the deletion flow when deletionProtection: true is set on a DBInstance resource.
Currently whats happening is:
- Deletion is initiated - When the DBInstance is removed from FluxCD (or deleted via kubectl delete), Kubernetes immediately sets
metadata.deletionTimestampon the resource - Controller attempts deletion - The ACK controller tries to delete the AWS RDS instance, but AWS responds with:
InvalidParameterCombination: Cannot delete protected DB Instance, please disable deletion protection and try again - Controller enters terminal state - The controller sets ACK.Terminal: true and stops reconciling because it cannot proceed
- Updates are blocked - Once
deletionTimestampis set, Kubernetes blocks updates to the spec (including changingdeletionProtection: false) because resources in deletion are considered immutable
https://github.com/aws-controllers-k8s/runtime/blob/main/pkg/runtime/reconciler.go#L469-L492
- Deadlock - The resource cannot be updated to remove deletion protection, and it cannot be deleted while deletion protection remains enabled
Workaround: What you currently did is a valid workaround, to manually change them via the console or cli.