Skip to content

feat: anyOf readiness condition requirements - #315

Merged
kubernetes-prow[bot] merged 2 commits into
kubernetes-sigs:mainfrom
vishnukothakapu:feat/condition-policy-allof-anyof
Aug 17, 2026
Merged

feat: anyOf readiness condition requirements#315
kubernetes-prow[bot] merged 2 commits into
kubernetes-sigs:mainfrom
vishnukothakapu:feat/condition-policy-allof-anyof

Conversation

@vishnukothakapu

Copy link
Copy Markdown
Contributor
  • Add ConditionPolicy type (allOf/anyOf) to NodeReadinessRuleSpec
  • Implement IsConditionsSatisfied() with allOf/anyOf evaluation logic
  • Update controller to use conditionPolicy when evaluating conditions
  • Add webhook validation to reject conditionPolicy with bootstrap-only mode
  • Expand controller test coverage for conditionPolicy scenarios
  • Update CRD schema to include conditionPolicy field

Description

Introduces a conditionPolicy field (allOf | anyOf) to NodeReadinessRuleSpec that controls how the list of node conditions is aggregated when evaluating a rule.

  • allOf (default): every condition must match its requiredStatus before the taint is removed — preserves existing behavior.
  • anyOf: at least one condition matching its requiredStatus is sufficient to remove the taint.

Related Issue #313

Type of Change

/kind feature /kind api-change

Testing

  • Added 4 new controller integration tests covering anyOf taint removal, anyOf taint addition, explicit allOf behavior, and missing-condition resolution under anyOf.
  • Existing test suite continues to pass (default allOf path unchanged).

Checklist

  • make test passes
  • make lint passes

Does this PR introduce a user-facing change?

Added conditionPolicy field to NodeReadinessRuleSpec (enum: allOf | anyOf).
allOf (default) preserves existing behavior; anyOf removes the taint when at least one condition is satisfied.
anyOf cannot be combined with enforcementMode: bootstrap-only.

@kubernetes-prow kubernetes-prow Bot added kind/feature Categorizes issue or PR as related to a new feature. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Jul 20, 2026
@kubernetes-prow

Copy link
Copy Markdown

@vishnukothakapu: The label(s) kind//kind cannot be applied, because the repository doesn't have them.

Details

In response to this:

  • Add ConditionPolicy type (allOf/anyOf) to NodeReadinessRuleSpec
  • Implement IsConditionsSatisfied() with allOf/anyOf evaluation logic
  • Update controller to use conditionPolicy when evaluating conditions
  • Add webhook validation to reject conditionPolicy with bootstrap-only mode
  • Expand controller test coverage for conditionPolicy scenarios
  • Update CRD schema to include conditionPolicy field

Description

Introduces a conditionPolicy field (allOf | anyOf) to NodeReadinessRuleSpec that controls how the list of node conditions is aggregated when evaluating a rule.

  • allOf (default): every condition must match its requiredStatus before the taint is removed — preserves existing behavior.
  • anyOf: at least one condition matching its requiredStatus is sufficient to remove the taint.

Related Issue #313

Type of Change

/kind feature /kind api-change

Testing

  • Added 4 new controller integration tests covering anyOf taint removal, anyOf taint addition, explicit allOf behavior, and missing-condition resolution under anyOf.
  • Existing test suite continues to pass (default allOf path unchanged).

Checklist

  • make test passes
  • make lint passes

Does this PR introduce a user-facing change?

Added conditionPolicy field to NodeReadinessRuleSpec (enum: allOf | anyOf).
allOf (default) preserves existing behavior; anyOf removes the taint when at least one condition is satisfied.
anyOf cannot be combined with enforcementMode: bootstrap-only.

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.

@netlify

netlify Bot commented Jul 20, 2026

Copy link
Copy Markdown

Deploy Preview for node-readiness-controller canceled.

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

@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 Jul 20, 2026
@kubernetes-prow

Copy link
Copy Markdown

Hi @vishnukothakapu. 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.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 20, 2026
@ajaysundark

Copy link
Copy Markdown
Contributor

/title feat: anyOf readiness condition requirements

@ajaysundark

Copy link
Copy Markdown
Contributor

/ok-to-test

@kubernetes-prow kubernetes-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 21, 2026
@ajaysundark

Copy link
Copy Markdown
Contributor

/retitle feat: anyOf readiness condition requirements

@kubernetes-prow kubernetes-prow Bot changed the title fix: update controller logic and test cases feat: anyOf readiness condition requirements Jul 21, 2026
@vishnukothakapu
vishnukothakapu force-pushed the feat/condition-policy-allof-anyof branch from 4f246fb to 61ffd9d Compare July 22, 2026 09:08
@ajaysundark

Copy link
Copy Markdown
Contributor

@vishnukothakapu is this ready for review?

@AnuragThePathak The code-changes are close to what you already worked on for defaultStatus. Are you available for a first pass review?

@ajaysundark

Copy link
Copy Markdown
Contributor

/ok-to-test

/cc @Karthik-K-N for API review.

@AnuragThePathak

Copy link
Copy Markdown
Contributor

@vishnukothakapu is this ready for review?

@AnuragThePathak The code-changes are close to what you already worked on for defaultStatus. Are you available for a first pass review?

Sure, I'll review within next 24 hours.

Comment thread api/v1alpha1/nodereadinessrule_types.go Outdated
@vishnukothakapu
vishnukothakapu force-pushed the feat/condition-policy-allof-anyof branch from 61ffd9d to 127dbbf Compare July 23, 2026 10:28

@AnuragThePathak AnuragThePathak left a comment

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.

Haven't reviewed tests yet but I think some of these changes are necessary.

Comment thread api/v1alpha1/nodereadinessrule_types.go Outdated
Comment thread api/v1alpha1/nodereadinessrule_types.go
Comment thread api/v1alpha1/nodereadinessrule_types.go Outdated
Comment thread internal/controller/nodereadinessrule_controller.go Outdated
Comment thread internal/controller/nodereadinessrule_controller.go Outdated
Comment thread manifests.yaml Outdated
@vishnukothakapu
vishnukothakapu force-pushed the feat/condition-policy-allof-anyof branch from 81dd061 to 7473b90 Compare July 24, 2026 14:33

@AnuragThePathak AnuragThePathak left a comment

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.

@vishnukothakapu I noticed that you deleted your previous commit and created a completely new one. From next time, prefer not removing the already pushed commits unless you know it won't have massive impact. Retaining what you already did helps review most of the time.

In any case, for my new comments, I won't suggest you to hurry. Instead I would encourage you to take some time and think (feel free to leverage AI either for ideas), then come up with something that allows you achieve the goal with minimal changes in what's already there following the existing conventions.

With that being said, also give others as well some time to reply, I am also curious to see if others also agree with my opinion of not introducing a completely new method for calculating is condition is satisfied or not.

P.S. if anything is not clear or you need more help, feel free to ask questions than applying some changes randomly.

Comment thread .gitignore Outdated
Comment thread api/v1alpha1/nodereadinessrule_types.go Outdated
Comment thread internal/controller/node_controller.go
Comment thread internal/controller/nodereadinessrule_controller.go
@AnuragThePathak

Copy link
Copy Markdown
Contributor

@vishnukothakapu great job. You have perfectly nailed the direction, I was referring to. I have some minor feedbacks which I'll address today if possible or tomorrow at worst. In the meantime you can proceed updating the test cases probably as they are failing now and also docs if applicable. I don't anticipate any further functional changes.

I am excluding, the point Karthik mentioned here by the way, I'll leave that up to you.

@AnuragThePathak AnuragThePathak left a comment

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.

Didn't review the test cases themselves as not passing as of now. Apply the changes I have suggested, fix the failing test cases, and add docs. We should be good.

Comment thread internal/controller/nodereadinessrule_controller.go Outdated
Comment thread internal/controller/nodereadinessrule_controller.go
Comment thread internal/controller/nodereadinessrule_controller.go Outdated
Comment thread internal/controller/nodereadinessrule_controller.go
Comment thread internal/controller/nodereadinessrule_controller.go Outdated
Comment thread internal/controller/nodereadinessrule_controller_test.go
Comment thread internal/controller/nodereadinessrule_controller_test.go Outdated
Comment thread internal/controller/nodereadinessrule_controller_test.go
@AnuragThePathak

Copy link
Copy Markdown
Contributor

/assign
/assign @vishnukothakapu

Comment thread internal/controller/nodereadinessrule_controller_test.go
@vishnukothakapu
vishnukothakapu force-pushed the feat/condition-policy-allof-anyof branch from 2998d12 to 2461f2c Compare August 14, 2026 17:07
@kubernetes-prow kubernetes-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 14, 2026
@vishnukothakapu
vishnukothakapu force-pushed the feat/condition-policy-allof-anyof branch 2 times, most recently from a17dbbf to 692c1cd Compare August 14, 2026 17:27
>
> `bootstrap-only` mode exists to verify that specific components have finished initializing. Using `anyOf` with `bootstrap-only` could lead to the node bootstrapping prematurely if just one component is ready, completely ignoring the initialization status of the others. The admission webhook enforces this restriction.


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.

Just noting the misconfiguration risk, I'm not sure if this is worth adding in a warning or adding a webhook validation (may be in a separate PR if we feel the same way, @AnuragThePathak) --

in anyOf rules, if defaultStatus and requiredStatus are both set as true, this could short-circuit the rule, without anyone realizing it. eg: HardwareDriverReady is missing but default status set as True (matching requiredStatus=True) would never taint the node.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ajaysundark Thanks for pointing that out!, You're totally right. If a condition defaults to its requiredStatus in an anyOf rule, the whole thing would silently short-circuit and never taint the node.

I'd be happy to add a CEL validation for this, making sure defaultStatus doesn't equal requiredStatus when the policy is anyOf.

@AnuragThePathak Do you want me to add this validation to this PR, or would you prefer we track it as a new issue and handle it in a follow-up PR so we can get this one merged first? Happy to do either!

@AnuragThePathak AnuragThePathak Aug 14, 2026

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.

@vishnukothakapu I would be in favor of updating the issue with this information-> adding webhook validation (CEL also there but not straight-forward at all + we have failurePolicy = fail, hence webhook is guaranteed to guard) -> updating the docs.

Better to keep things atomic imo

cc @ajaysundark

by the way regarding the lgtm label, apparently I do not have permission to use it so far. probably need to join the org, idk who they allow. Feel free to enlighten me if the process is not as complex as I am imagining.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@AnuragThePathak Makes total sense! I agree that keeping this atomic is the best approach. I'll update the original issue with @ajaysundark 's edge case and we can tackle the Go webhook validation and docs update in a follow-up PR.

Assuming everything else looks good, is this PR good to go?

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.

Oh about this PR. Personally I was in favor of adding the validation and doc updates in this PR only so that if this feature goes live, people use it the right way since day 1. Were you two in favor of decoupling both changes?

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.

I have read your latest message on the issue. Looks good, wording can be improved (slightly lacks the precision) but rest ok. With that being said, also updating the issue adding a post script or something like that might be a good idea, just in case people decide to read just the top text.

@vishnukothakapu
vishnukothakapu force-pushed the feat/condition-policy-allof-anyof branch from 692c1cd to 59b5fc1 Compare August 14, 2026 18:43

@AnuragThePathak AnuragThePathak left a comment

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.

Seems like I ended up reviewing earlier by mistake. But fix the doc issue and one extra line mentioned (go through all comments once)

Comment thread api/v1alpha1/nodereadinessrule_types.go Outdated
Comment thread api/v1alpha1/nodereadinessrule_types.go
Comment thread docs/book/src/reference/api-spec.md Outdated
Comment thread docs/book/src/reference/api-spec.md
Comment thread docs/book/src/user-guide/concepts.md
Comment thread api/v1alpha1/nodereadinessrule_types.go Outdated
@vishnukothakapu
vishnukothakapu force-pushed the feat/condition-policy-allof-anyof branch from 53c83d7 to ad6ab84 Compare August 14, 2026 20:42
@vishnukothakapu
vishnukothakapu force-pushed the feat/condition-policy-allof-anyof branch from ad6ab84 to fef71b5 Compare August 15, 2026 09:30

@AnuragThePathak AnuragThePathak left a comment

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.

LGTM. I would suggest creating a new issue for defaultStatus + conditionPolicy follow-up when you see this message considering the existing issue will automatically be closed once we merge this PR.

@vishnukothakapu

Copy link
Copy Markdown
Contributor Author

LGTM. I would suggest creating a new issue for defaultStatus + conditionPolicy follow-up when you see this message considering the existing issue will automatically be closed once we merge this PR.

@AnuragThePathak Thank you for the review and approval! I will open the new issue for the defaultStatus + conditionPolicy follow-up as soon as this is merged.

@AnuragThePathak

Copy link
Copy Markdown
Contributor

@vishnukothakapu ideally speaking there's no rule like having to wait for this PR to get merged to actually create the new issue. But anyways it's your preference, since the details are logged properly under current issue, I won't push further on creating the issue right away.

For your information @ajaysundark maybe you can take a look whenever possible. I am still figuring out on accessing the prow commands by the way. @vishnukothakapu is in favor of creating a separate PR for the restriction on using defaultStatus and conditionPolicy at the same time. I think that will be convenient for us to review as well. Hopefully that's not an issue for release?

DefaultStatus: condReq.GetDefaultStatus(),
})

log.V(1).Info("Condition evaluation", "node", node.Name, "rule", rule.Name,

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.

@vishnukothakapu is it possible to capture the rule is satisfied with anyOf requirement here in this log (or a separate log?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ajaysundark , The Evaluation result log that prints immediately after this loop actually captures exactly that (it explicitly logs both "conditionsSatisfied": true and "conditionPolicy": "anyOf").

However, if you think it would be helpful to also have conditionPolicy printed inside this per-condition log for easier debugging, I can definitely add that in the next follow-up PR! Let me know what you prefer.

@ajaysundark ajaysundark left a comment

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.

@vishnukothakapu Thanks for your contribution!

/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 17, 2026
@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ajaysundark, AnuragThePathak, vishnukothakapu

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 17, 2026
@kubernetes-prow
kubernetes-prow Bot merged commit e371598 into kubernetes-sigs:main Aug 17, 2026
12 checks passed
@vishnukothakapu

Copy link
Copy Markdown
Contributor Author

@AnuragThePathak @ajaysundark Thank you both for your thorough reviews and guidance throughout this PR! I really appreciate the time you took to help shape this feature. I've opened the follow-up issue for the defaultStatus webhook validation and will get started on that next!

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/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants