-
Notifications
You must be signed in to change notification settings - Fork 34
Add a webhook for namespace deletion #719
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 a webhook for namespace deletion #719
Conversation
✅ Deploy Preview for kubernetes-sigs-kmm ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qbarrand The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
a49e36c
to
2574a94
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #719 +/- ##
==========================================
- Coverage 79.09% 78.88% -0.21%
==========================================
Files 51 52 +1
Lines 5109 3998 -1111
==========================================
- Hits 4041 3154 -887
+ Misses 882 653 -229
- Partials 186 191 +5 ☔ View full report in Codecov by Sentry. |
- do not delete any namespace containing at least a `Module` resource. | ||
To avoid situations where KMM is unable to unload the kernel module from nodes, make sure those resources are not | ||
deleted while the `Module` resource is still present in the cluster in any state, including `Terminating`. | ||
KMM ships with an admission webhook that rejects the deletion of namespaces that contain at least one `Module` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KMM ships with an admission webhook that rejects the deletion of namespaces that contain at least one `Module` | |
KMM ships with a validating admission webhook that rejects the deletion of namespaces that contain at least one `Module` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks!
This commit makes KMM set the kmm.node.k8s.io/contains-modules label on all namespaces that contain at least one Module. It also adds a new webhook to the bundle and the corresponding handler in the manager. The new webhook rejects namespace deletions if the kmm.node.k8s.io/contains-modules label is present on the namespace. This avoids entering situations where the namespace is being deleted and KMM cannot create unloading Pods to honor Module deletion.
2574a94
to
304f486
Compare
@mresvanis @yevgeny-shnaidman @ybettan PTAL 🙂 |
/lgtm |
This commit makes KMM set the kmm.node.k8s.io/contains-modules label on all namespaces that contain at least one Module. It also adds a new webhook to the bundle and the corresponding handler in the manager. The new webhook rejects namespace deletions if the kmm.node.k8s.io/contains-modules label is present on the namespace. This avoids entering situations where the namespace is being deleted and KMM cannot create unloading Pods to honor Module deletion.
* Add a webhook for namespace deletion (#719) This commit makes KMM set the kmm.node.k8s.io/contains-modules label on all namespaces that contain at least one Module. It also adds a new webhook to the bundle and the corresponding handler in the manager. The new webhook rejects namespace deletions if the kmm.node.k8s.io/contains-modules label is present on the namespace. This avoids entering situations where the namespace is being deleted and KMM cannot create unloading Pods to honor Module deletion. * Restrict checks for image existence (#734) Before populating the NodeModulesConfig object, only check if built or signed image exist on the registry. Add a log message when the NodeModulesConfig is not populated for that reason. * Make slight changes to the CRDs (#736) Module: make moduleName an optional field. ManagedClusterModule: make spokeNamespace a required field.
This commit makes KMM set the
kmm.node.k8s.io/contains-modules
label on all namespaces that contain at least oneModule
.It also adds a new webhook to the bundle and the corresponding handler in the manager.
The new webhook rejects namespace deletions if the
kmm.node.k8s.io/contains-modules
label is present on the namespace. This avoids entering situations where the namespace is being deleted and KMM cannot create unloading Pods to honorModule
deletion.Fixes #708
/cc @mresvanis @yevgeny-shnaidman @ybettan