Repository navigation
fix(api): avoid indexing split() in taint CEL rules for K8s 1.38 cost estimation - #505
Merged
kubernetes-prow[bot] merged 1 commit intoNov 13, 2026
Conversation
👷 Deploy request for node-readiness-controller pending review.Visit the deploys page to approve it
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ajaysundark 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 |
Contributor
Author
|
This is a breaking change in K8s-api. I'll followup with upstream. The fix involves removing the problematic /cc @Karthik-K-N |
Karthik-K-N
reviewed
Nov 13, 2026
… estimation Kubernetes 1.38 upgraded cel-go to v0.33.0, which stops appending @Items to the AST path of list indexing expressions when the receiver has an empty path (such as self.key.split('/')). Because Kubernetes's CEL cost estimator returns Elem: nil in the ResultSize of split(), indexing self.key.split('/')[1] receives UnknownSizeEstimate() (MaxUint64), causing .matches() on the indexed element to exceed the CRD validation cost limit (MaxUint64 > 10,000,000). Since previous rules already validate that self.key starts with 'readiness.k8s.io/' (17 chars) and has a single '/' separator, validate the name length and character set directly on self.key. This reduces the taint rules' static estimated cost to 10,380,974 and passes Kubernetes 1.38 CRD validation. Change-Id: I9c02cd527be0c1e29b147ed52eb2123bec20e053
ajaysundark
force-pushed
the
fix-crd-cel-cost
branch
from
November 13, 2026 07:05
d5c648f to
23daab8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Kubernetes 1.38 upgraded
cel-goto v0.33.0, which stops appending@itemsto the AST path of list indexing expressions when the receiver has an empty path (such asself.key.split('/')). Because Kubernetes's CEL cost estimator returnsElem: nilin theResultSizeofsplit(), indexingself.key.split('/')[1]receivesUnknownSizeEstimate()(MaxUint64), causing.matches()on the indexed element to exceed the CRD validation cost limit (18446744073709551615 > 10000000) and rejectingNodeReadinessRuleCRD creation on 1.38kube-apiserver.Since the preceding rules on
spec.taintalready verify thatself.key.startsWith('readiness.k8s.io/')(17 characters) andsize(self.key.split('/')) == 2, validate the name part length (self.key.size() >= 18 && self.key.size() <= 80) and character set (self.key.matches('^readiness[.]k8s[.]io/[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$')) directly onself.key. This brings the rule costs down to8and5,033,170(10,380,974total acrossspec.taint) and passes Kubernetes 1.38 CRD validation.Related Issue
None
Type of Change
/kind bug
/kind api-change
Testing
config/crd/bases/readiness.node.x-k8s.io_nodereadinessrules.yamlagainst Kubernetes 1.38validation.ValidateCustomResourceDefinition(cel-gov0.33.2): 0 validation errors,spec.tainttotal static estimated cost10,380,974(limit100,000,000).make test,make lint, andmake verify.Checklist
make testpassesmake lintpassesDoes this PR introduce a user-facing change?
Generative AI Usage Disclosure
How they were used:
An AI coding agent diagnosed the
cel-gov0.33.0 cost estimation change inapi/v1alpha1/nodereadinessrule_types.go, regenerated the CRD manifests, and verified the CRD against Kubernetes 1.38'sValidateCustomResourceDefinition. I reviewed the changes.