-
Notifications
You must be signed in to change notification settings - Fork 259
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
Control post-delete hook #2076
base: master
Are you sure you want to change the base?
Control post-delete hook #2076
Conversation
|
Welcome @alekseysen! |
Hi @alekseysen. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
✅ Deploy Preview for kubernetes-sigs-nfd ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@alekseysen I didn't fully understand the description. How/why does NFD get uninstalled? Is the problem that uninstalling the parent project also removes NFD or is NFD removed manually in your case? |
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.
Pull Request Overview
This PR implements a new configuration flag ("cleanupLabels") to control whether labels generated by NFD are preserved after removal, which is key to preventing failures in dependent components.
- Added the cleanupLabels flag to the Helm values file.
- Wrapped parts of the post-delete job template in a conditional block based on the new flag.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
deployment/helm/node-feature-discovery/values.yaml | Added a new configuration flag to enable cleanup of labels. |
deployment/helm/node-feature-discovery/templates/post-delete-job.yaml | Wrapped resource creation in a conditional block to honor the cleanupLabels setting. |
Comments suppressed due to low confidence (2)
deployment/helm/node-feature-discovery/values.yaml:18
- [nitpick] Consider adding an inline comment to clarify the purpose and use case of the 'cleanupLabels' flag for future maintainers.
+cleanupLabels: true
deployment/helm/node-feature-discovery/templates/post-delete-job.yaml:1
- [nitpick] Consider adding a brief comment above the conditional block to clarify why the block is being conditionally rendered based on 'cleanupLabels'.
+{{- if .Values.cleanupLabels }}
hi @marquiz, we've got following use-case: NFD chart is deployed as a sub-chart from our project. Obviously, we've got some workloads (e.g. deployments. daemonsets) which require NFD labels to be scheduled on nodes. These workloads aren't deployed as a part of helm chart. To maintain system integrity and ensure continued functionality, there must be an option that allows any modifications made by NFD to be preserved upon its removal. These changes are essential for system stability, compatibility, and optimized performance, preventing potential disruptions or regressions. Removing these modifications could lead to broken dependencies, security vulnerabilities, or degraded system performance. By retaining these enhancements, organizations can safeguard their infrastructure while ensuring seamless transitions and future adaptability. |
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.
Thank you @alekseysen for the detailed description. I think this change is good, especially as it's behind an option.
We'd also need to document the new value in docs/deployment/helm.md
/ok-to-test
@@ -15,6 +15,8 @@ featureGates: | |||
|
|||
priorityClassName: "" | |||
|
|||
cleanupLabels: true |
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.
nitpick about the naming. It cleans up other stuff too (i.e. annotations, extended resources and taints), so I'd suggest something like postDeleteCleanup
or smth. WDYT @alekseysen
0bafb7f
to
21c6a7d
Compare
22ecf8a
to
bdb65e8
Compare
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.
Thanks @alekseysen looks good to me.
/assign @ArangoGutierrez
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.
Pull Request Overview
This PR introduces a new Helm flag, postDeleteCleanup, to control whether the post-delete hook should execute in order to preserve NFD-generated labels after uninstall.
- Adds postDeleteCleanup configuration in the Helm documentation and values file.
- Implements a conditional in the post-delete job template to gate resource creation based on the flag.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
docs/deployment/helm.md | Adds documentation for the new postDeleteCleanup parameter. |
deployment/helm/node-feature-discovery/values.yaml | Introduces the postDeleteCleanup flag with a default set to true. |
deployment/helm/node-feature-discovery/templates/post-delete-job.yaml | Wraps the post-delete job resource definition with a conditional check for postDeleteCleanup. |
Comments suppressed due to low confidence (1)
deployment/helm/node-feature-discovery/templates/post-delete-job.yaml:1
- Ensure that this wrapping if block correctly encapsulates the entire resource definition without interfering with any nested conditionals. Verify that the corresponding '{{- end }}' at the bottom properly closes the newly added block and does not conflict with existing template logic.
{{- if .Values.postDeleteCleanup }}
deployment/helm/node-feature-discovery/templates/post-delete-job.yaml
Outdated
Show resolved
Hide resolved
There are situations where the modifications performed by the NFD need to be preserved even after its removal. One such use case arises when NFD is installed as part of another project. By design, uninstalling the parent project does not remove all its components. However, the remaining components still rely on the labels created by NFD. If NFD is removed, these labels will be deleted, causing dependent components to fail. To maintain system integrity and ensure continued functionality, adding the 'postDeleteCleanup' option that allows any modifications made by NFD to be preserved upon its removal. Signed-off-by: Aleksey Senin <[email protected]>
bdb65e8
to
8506bd7
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alekseysen, marquiz 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 |
@ArangoGutierrez PTAL |
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.
/lgtm
/hold
to give time for @ArangoGutierrez to have a look as well.
LGTM label has been added. Git tree hash: 1fdab651e0d46b7820d9f0e0bb15a19e4e8a5a54
|
@ArangoGutierrez any comments? |
There are situations where the labels generated by the NFD need to be preserved even after its removal.
One such use case arises when NFD is installed as part of another project. By design, uninstalling the parent project does not remove all its components. However, the remaining components still rely on the labels created by NFD. If NFD is removed, these labels will be deleted, causing dependent components to fail.