Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add annotation to ignore underlying resource deletion. #9

Closed
5 of 7 tasks
smileisak opened this issue Jan 25, 2023 · 3 comments · Fixed by #39
Closed
5 of 7 tasks

Add annotation to ignore underlying resource deletion. #9

smileisak opened this issue Jan 25, 2023 · 3 comments · Fixed by #39
Assignees
Labels
enhancement New feature or request go PR that updates go code lifecycle/frozen

Comments

@smileisak
Copy link
Member

smileisak commented Jan 25, 2023

Objective: To add the ability for users to specify that resources created in a Space should not be deleted when the Space is deleted.

Steps:

  • Add an annotation "nauticus.io/ignore-deletion" to the Space CRD.
  • Update the Nauticus controller code to check for this annotation when a Space is deleted.
  • If the annotation is present, update the owner references of all resources within the Space to remove the Space as the owner. This will prevent Kubernetes from automatically deleting the resources when the Space is deleted.
  • Create a field in the Space CRD that allow users to specify a grace period before the controller deletes the resources.
  • Modify the controller to delete all resources in the space after the grace period, this will allow the users to drain their resources before they are deleted.
  • Test the new feature by creating a Space and adding resources, then deleting the Space and verifying that the resources are not deleted automatically and the controller deletes them after the grace period.
  • Document the new feature in the README and update the user documentation accordingly.

References

@smileisak smileisak self-assigned this Jan 26, 2023
@smileisak smileisak added the enhancement New feature or request label Jan 26, 2023
@sftim
Copy link

sftim commented Feb 13, 2023

Does this annotation also affect finalizers on the Namespace for the Space?

@smileisak
Copy link
Member Author

@sftim I don't think so, today we have a lightweight finalizer in the Space controller to manage the deletion of the Space resource.

We should find a way to update the controller so it can ignores the underlying managed resources when a specific annotation is present. Something equivalent to Google Config Connector deletion policy.

https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/6867b8385179bc1e09fe21aa20c58a31f6f8b9bc/pkg/controller/deletiondefender/controller.go#L126-L131

@smileisak smileisak added the go PR that updates go code label Feb 19, 2023
@github-actions
Copy link

This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach #nauticus on Kubernetes Slack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request go PR that updates go code lifecycle/frozen
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants