Skip to content

fix: stop the chart suggesting an empty nodeSelector - #404

Merged
kubernetes-prow[bot] merged 2 commits into
kubernetes-sigs:mainfrom
tejassinghbhati:fix/chart-empty-nodeselector-guidance
Aug 13, 2026
Merged

fix: stop the chart suggesting an empty nodeSelector#404
kubernetes-prow[bot] merged 2 commits into
kubernetes-sigs:mainfrom
tejassinghbhati:fix/chart-empty-nodeselector-guidance

Conversation

@tejassinghbhati

Copy link
Copy Markdown
Contributor

Description

The chart's error message for nodeReadinessRules told users to set nodeSelector: {} when a rule should match all nodes:

spec.nodeSelector is required and immutable. Set it explicitly; use 'nodeSelector: {}' only if the rule is intended to match ALL nodes.

The validating webhook rejects exactly that, in validateSpec:

if selector != nil && selector.Empty() {
    allErrs = append(allErrs, field.Required(field.NewPath("spec", "nodeSelector"), "nodeSelector must not be empty"))
}

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 selector test still renders nodeSelector: {}, and the fails rendering when nodeSelector is omitted test matches on spec.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 --strict passes, 19 tests across 5 suites, unchanged from before. helm lint clean.

Checklist

  • make test passes
  • make lint passes

Does this PR introduce a user-facing change?

NONE

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>
@kubernetes-prow kubernetes-prow Bot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 13, 2026
@netlify

netlify Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploy Preview for node-readiness-controller canceled.

Name Link
🔨 Latest commit fe723bb
🔍 Latest deploy log https://app.netlify.com/projects/node-readiness-controller/deploys/6a7df74d9ad85d0008aaa87e

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 13, 2026
@kubernetes-prow

Copy link
Copy Markdown

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@kubernetes-prow kubernetes-prow Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 13, 2026
@ajaysundark

Copy link
Copy Markdown
Contributor

/lgtm

Thanks. I suggested rewording this a bit, could you ptal!

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 13, 2026
@tejassinghbhati

Copy link
Copy Markdown
Contributor Author

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?
The verify-all failure looks unrelated. It is lychee getting a 403 on the Slack links in README.md and introduction.md, neither of which this PR touches. #379 passed verify-all on the same base commit, so it looks intermittent rather than broken.
/retest

@kubernetes-prow

Copy link
Copy Markdown

@tejassinghbhati: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

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?
The verify-all failure looks unrelated. It is lychee getting a 403 on the Slack links in README.md and introduction.md, neither of which this PR touches. #379 passed verify-all on the same base commit, so it looks intermittent rather than broken.
/retest

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.

@ajaysundark

Copy link
Copy Markdown
Contributor

cc @ajaysundark

@ajaysundark
ajaysundark self-requested a review August 13, 2026 16:41
{{- $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 "?")) }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{- 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>
@kubernetes-prow kubernetes-prow Bot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 13, 2026
@tejassinghbhati

Copy link
Copy Markdown
Contributor Author

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

@kubernetes-prow

Copy link
Copy Markdown

@tejassinghbhati: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

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

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.

@tejassinghbhati

Copy link
Copy Markdown
Contributor Author

Wording is in as fe723bb, so this just needs an /ok-to-test and the lgtm back when you get a minute. My /retest bounced since I am not in the org yet.

Same for #372, #388 and #396, none of them have had CI run at all.

@ajaysundark

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 13, 2026
@kubernetes-prow

Copy link
Copy Markdown

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 13, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit efd47be into kubernetes-sigs:main Aug 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Helm chart suggests nodeSelector: {} but the webhook rejects it

2 participants