fix: stop the chart suggesting an empty nodeSelector - #404
Conversation
The chart's error message told users to set 'nodeSelector: {}' when a
rule should match all nodes, but the validating webhook rejects an empty
selector outright with "nodeSelector must not be empty". Following the
chart's own guidance with the webhook on fails on create.
With the webhook off, which is the default, nothing blocks it and the
rule matches every node in the cluster instead.
Reword the message so it stops recommending it and says what actually
happens. The prefix the chart test matches on is unchanged.
Signed-off-by: tejassinghbhati <tejassinghbhati077@gmail.com>
✅ Deploy Preview for node-readiness-controller canceled.
|
|
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 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. |
|
/lgtm Thanks. I suggested rewording this a bit, could you ptal! |
|
Thanks! I can't see the suggestion on my end, nothing showing up as a review comment on the diff. Might still be pending on your side, could you submit it? |
|
@tejassinghbhati: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
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. |
|
cc @ajaysundark |
| {{- $spec := omit $rule "name" }} | ||
| {{- if or (not (hasKey $spec "nodeSelector")) (kindIs "invalid" $spec.nodeSelector) }} | ||
| {{- fail (printf "nodeReadinessRules[%s]: spec.nodeSelector is required and immutable. Set it explicitly; use 'nodeSelector: {}' only if the rule is intended to match ALL nodes." ($rule.name | default "?")) }} | ||
| {{- fail (printf "nodeReadinessRules[%s]: spec.nodeSelector is required and immutable. Set it explicitly. An empty selector matches every node in the cluster, and is rejected by the validating webhook when that is enabled." ($rule.name | default "?")) }} |
There was a problem hiding this comment.
| {{- fail (printf "nodeReadinessRules[%s]: spec.nodeSelector is required and immutable. Set it explicitly. An empty selector matches every node in the cluster, and is rejected by the validating webhook when that is enabled." ($rule.name | default "?")) }} | |
| {{- fail (printf "nodeReadinessRules[%s]: spec.nodeSelector is required and immutable. An empty selector to match every node in the cluster is rejected by the validating webhook to avoid cluster wide misconfiguration risks." ($rule.name | default "?")) }} |
Signed-off-by: tejassinghbhati <tejassinghbhati077@gmail.com>
|
Taken, thanks. One thing so you have it: the webhook is off by default, so the empty selector only actually gets rejected when someone turns it on. Default install it just goes through and matches everything. Your wording reads like it is always blocked. Fine by me either way, that gap is really #403's problem not this PR's. The verify-all failure is unrelated by the way, lychee 403s on the Slack links in README.md and introduction.md, neither of which this PR touches. #379 passed on the same base so it looks like a flake. /retest |
|
@tejassinghbhati: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
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. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ajaysundark, tejassinghbhati The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
The chart's error message for
nodeReadinessRulestold users to setnodeSelector: {}when a rule should match all nodes:The validating webhook rejects exactly that, in
validateSpec:So following the chart's own guidance with the webhook enabled fails on create. With the webhook off, which is the default, nothing blocks it and the rule matches every node in the cluster instead.
This reworks the message so it stops recommending it and says what actually happens either way. It is message only, no behaviour change. The chart's existing
renders full rule spec with explicit all-nodes selectortest still rendersnodeSelector: {}, and thefails rendering when nodeSelector is omittedtest matches onspec.nodeSelector is required, which is unchanged.I left the larger question in #403 rather than deciding it here: the only guard against a rule that taints the whole cluster currently lives in a component that is off by default, and moving it into the CRD as a CEL rule would be an API change that rejects existing rules. That needs a maintainer call, not a drive-by.
Related Issue
Fixes #403
Type of Change
/kind bug
Testing
helm unittest charts/nrr-controller --strictpasses, 19 tests across 5 suites, unchanged from before.helm lintclean.Checklist
make testpassesmake lintpassesDoes this PR introduce a user-facing change?