[#435] fix: webhook taint conflict check incorrectly rejects dry-run rules - #436
Conversation
validateTaintConflicts blocked creation of a dryRun:true rule whenever an enforcement rule already managed the same taint key on overlapping nodes. A dry-run rule never writes taints to nodes, so it cannot produce the concurrent-update conflict that the guard is designed to prevent. The fix adds an early continue when either the incoming or the existing rule has Spec.DryRun set, so the conflict check only applies to pairs of enforcement rules. Two regression tests are added: one confirms that a dry-run rule is accepted when an enforcement rule holds the same taint key, and the reverse, that an enforcement rule is accepted when a dry-run rule already exists for that key. Signed-off-by: Tejas Singh Bhati <tejassinghbhati077@gmail.com>
✅ Deploy Preview for node-readiness-controller canceled.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tejassinghbhati 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 @tejassinghbhati. 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 Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain 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. |
|
Hi, thanks for raising the PR. I am not clear where this is needed. I asked a question on the issue #435 (comment), can we discuss this further before arriving at a fix? |
|
Sounds good, |
Summary
The validation webhook blocks creation of a
dryRun: truerule whenever an enforcement rule already manages the same taint key on overlapping nodes. Because dry-run rules never write taints to nodes, they cannot produce the concurrent-update conflict the guard is designed to prevent. The rejection is a false positive that makes the primary use case fordryRun, previewing the impact of a new rule against a taint key already in active use is impossible when the webhook is enabled.Root cause
validateTaintConflictsiterates all existing rules and flags any pair sharingtaint.key+taint.effecton overlapping selectors. It does not checkspec.dryRunon either side, so it treats dry-run rules as if they were enforcement rules.Fix
Add an early
continueinsidevalidateTaintConflictswhen either the incoming or the existing rule hasSpec.DryRunset:Tests
Two regression tests added to
nodereadinessgaterule_webhook_test.go:dryRun: truerule with the same taint key as an existing enforcement rule on overlapping nodes is accepted.dryRun: truerule already exists for the same taint key on overlapping nodes.go test ./internal/webhook/...— 41 passed, 0 failed.Related issue
Fixes #435
Type of change
/kind bug
Checklist
go build ./...passesgo test ./internal/webhook/...passes (41 tests, no envtest required)Does this PR introduce a user-facing change?