cleanup: remove dead cleanupNodesAfterSelectorChange code path#250
cleanup: remove dead cleanupNodesAfterSelectorChange code path#250dorodb-web22 wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dorodb-web22 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @dorodb-web22. 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 Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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 node-readiness-controller canceled.
|
|
/ok-to-test Thanks for the PR @dorodb-web22. Changes wrt unreachable code are fine. Just one non-blocking suggestion: we have an integration test that checks for the immutability of the nodeSelector field - node-readiness-controller/internal/controller/nodereadinessrule_controller_test.go Lines 1475 to 1484 in b4a52fa Could you add a ginkgo By() step annotation in the ^ test - so we actually print the CEL X-validation rejection error by API server, in our test logs. (I was running these tests locally, and realized they pass silently even in verbose mode.) |
Summary
Removes the unreachable
cleanupNodesAfterSelectorChangecode path and all associated helpers that became dead code afternodeSelectorwas made immutable.Background
NodeReadinessRule.spec.nodeSelectoris immutable (enforced by the webhook since PR #164). Because the selector can never change after creation, the following code paths can never be triggered:Reconcilethat detects selector changes and invokes the cleanupgetCachedRule— only used by that blockcleanupNodesAfterSelectorChange: the cleanup function itselfnodeSelectorChangedinhelper.go: the comparison helperThis was noted as a cleanup opportunity in issue #245.
Changes
internal/controller/nodereadinessrule_controller.goReconcilegetCachedRulecleanupNodesAfterSelectorChangeinternal/controller/helper.gonodeSelectorChangedfmtandmetav1importsTesting
go build ./...passes cleanly with no unused import errors.Closes #245