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

fix(webhook): deny deletion of SubNamespace with child namespaces #145

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

erikgb
Copy link
Contributor

@erikgb erikgb commented Jul 16, 2024

If a client is allowed to delete a SubNamespace where the sub-namespace has child namespaces, the controller becomes stuck on the finalization of the SubNamespace. The controller will not be allowed to delete the sub-namespaces by our namespace webhook.

Since Kubernetes has no way to undelete a resource (unset the deletionTimestamp field), all child namespaces must be manually deleted to allow the SubNamespace deletion to be finalized.

This PR introduces handling of DELETE verb to the subnamespaces validating webhook ensuring no subnamespaces can be deleted if the sub-namespace has child namespaces. It seems like there was a minor bug in the validating webhook configuration: it was configured to handle UPDATE verb, but the implementation was only addressing CREATE.

Close #144

@rkwmt rkwmt requested a review from zoetrope July 17, 2024 01:05
@zoetrope zoetrope added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request bug Something isn't working labels Jul 18, 2024
Copy link
Member

@zoetrope zoetrope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zoetrope zoetrope merged commit 68417ba into cybozu-go:main Jul 18, 2024
8 checks passed
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.

Should not attempt to finalize SubNamespace containing sub-namespaces
2 participants