Skip to content

feat: Restrict NodeReadinessRuleSpec.Taint to "readiness.k8s.io/" prefix#112

Open
sats-23 wants to merge 1 commit intokubernetes-sigs:mainfrom
sats-23:issue106
Open

feat: Restrict NodeReadinessRuleSpec.Taint to "readiness.k8s.io/" prefix#112
sats-23 wants to merge 1 commit intokubernetes-sigs:mainfrom
sats-23:issue106

Conversation

@sats-23
Copy link
Contributor

@sats-23 sats-23 commented Jan 26, 2026

Fixes #106

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sats-23
Once this PR has been reviewed and has the lgtm label, please assign mrunalp for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@netlify
Copy link

netlify bot commented Jan 26, 2026

Deploy Preview for node-readiness-controller ready!

Name Link
🔨 Latest commit ec812d9
🔍 Latest deploy log https://app.netlify.com/projects/node-readiness-controller/deploys/698da4ba85cf8900086d7ce8
😎 Deploy Preview https://deploy-preview-112--node-readiness-controller.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot
Copy link
Contributor

Welcome @sats-23!

It looks like this is your first PR to kubernetes-sigs/node-readiness-controller 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/node-readiness-controller has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 26, 2026
@ajaysundark ajaysundark requested review from Karthik-K-N and removed request for SergeyKanzhelev and tallclair January 26, 2026 17:11
@sats-23 sats-23 force-pushed the issue106 branch 2 times, most recently from 211e30a to 770db23 Compare January 26, 2026 17:44
@ajaysundark
Copy link
Contributor

@Karthik-K-N Do you have time for this review?

@Karthik-K-N
Copy link
Contributor

@Karthik-K-N Do you have time for this review?

Yes, I will check thanks.

// +kubebuilder:validation:XValidation:rule="self.key.startsWith('readiness.k8s.io/')",message="taint key must start with 'readiness.k8s.io/'"
// +kubebuilder:validation:XValidation:rule="self.key.size() >= 17 && self.key.size() <= 253",message="taint key length must be between 17 and 253 characters"
// +kubebuilder:validation:XValidation:rule="!has(self.value) || self.value.size() <= 63",message="taint value length must be at most 63 characters"
// +kubebuilder:validation:XValidation:rule="self.effect in ['NoSchedule', 'PreferNoSchedule', 'NoExecute']",message="taint effect must be one of 'NoSchedule', 'PreferNoSchedule', 'NoExecute'"
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good. Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

Also lets document it somewhere in the book or doc that the readiness.k8s.io/ should be the prefix for taints, User should be aware of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will do

taintField := specField.Child("taint")
if spec.Taint.Key == "" {
allErrs = append(allErrs, field.Required(taintField.Child("key"), "taint key cannot be empty"))
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies, I think with CEL, Nowhere it could skip the validation there so webhook might not be needed. We can remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking what in case of conflict detection, like, if a rule A already exists and rule B is applied on the same set of nodes (same taint), then individually with CEL, rule B may pass but cause conflict in the controller?
In case, this is invalid, I can remove it

@ajaysundark
Copy link
Contributor

/retest

@ajaysundark
Copy link
Contributor

/assign @sats-23

looks like the tests need your attention, ptal

@ajaysundark
Copy link
Contributor

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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.

Restrict NodeReadinessRuleSpec.Taint to "readiness.k8s.io/" prefix

4 participants