Skip to content

feat: implement TTL secret controller for orphaned secrets cleanup - #958

Open
piyxsh31 wants to merge 1 commit into
openeverest:mainfrom
piyxsh31:feat/secret-cleanup-ttl
Open

feat: implement TTL secret controller for orphaned secrets cleanup#958
piyxsh31 wants to merge 1 commit into
openeverest:mainfrom
piyxsh31:feat/secret-cleanup-ttl

Conversation

@piyxsh31

@piyxsh31 piyxsh31 commented Jun 4, 2026

Copy link
Copy Markdown

CHANGE DESCRIPTION

Problem:

When a BackupStorage Custom Resource fails to be created (e.g., due to an API error), the Secret containing the storage credentials that was just created gets left orphaned. Because there's no parent CR, it lacks an OwnerReference and Kubernetes native garbage collection ignores it.

Related pull requests

closes: openeverest/openeverest#2332

Cause:
We modified the API handler to apply a TTL annotation instead of doing fragile synchronous deletion on failure. However, the operator needed a mechanism to recognize this annotation and actually perform the asynchronous cleanup of these orphaned Secrets.

Solution:
Introduced a new SecretReconciler (secret_controller.go) to watch and actively delete orphaned Secrets that still carry the expired everest.percona.com/cleanup-after annotation. Updated BackupStorageReconciler to adopt Secrets by stripping this annotation upon successful CR creation.

CHECKLIST

Helm chart

  • Is the helm chart updated with the new changes? (if applicable)

Jira

  • Is the Jira ticket created and referenced properly?

Tests

  • Is an Integration test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Signed-off-by: Piyush <agrawalpiyush415@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Orphaned Secrets left behind when BackupStorage CR creation fails

1 participant