KEP-5471: Extend tolerations operators (#134665)

* Add numeric operations to tolerations

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* code review feedback

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* add default feature gate

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* Add integration tests

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* Add toleration value validation

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* Add validate options for new operators

Signed-off-by: helayoty <heelayot@microsoft.com>

* Remove log

Signed-off-by: helayoty <heelayot@microsoft.com>

* Update feature gate check

Signed-off-by: helayoty <heelayot@microsoft.com>

* emove IsValidNumericString func

Signed-off-by: helayoty <heelayot@microsoft.com>

* Implement IsDecimalInteger

Signed-off-by: helayoty <heelayot@microsoft.com>

* code review feedback

Signed-off-by: helayoty <heelayot@microsoft.com>

* Add logs to v1/toleration

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
Signed-off-by: helayoty <heelayot@microsoft.com>

* Update integration tests and address code review feedback

Signed-off-by: helayoty <heelayot@microsoft.com>

* Add feature gate to the scheduler framework

Signed-off-by: helayoty <heelayot@microsoft.com>

* Remove extra test

Signed-off-by: helayoty <heelayot@microsoft.com>

* Fix integration test

Signed-off-by: helayoty <heelayot@microsoft.com>

* pass feature gate via TolerationsTolerateTaint

Signed-off-by: helayoty <heelayot@microsoft.com>

---------

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
Signed-off-by: helayoty <heelayot@microsoft.com>

Kubernetes-commit: aceb89debc2632c5c9956c8b7ef591426a485447
This commit is contained in:
Heba
2025-11-10 12:42:54 -08:00
committed by Kubernetes Publisher
parent 6ce2c0f8c3
commit 5020b674f8
3 changed files with 8 additions and 7 deletions

View File

@@ -32,9 +32,10 @@ type TolerationApplyConfiguration struct {
// If the key is empty, operator must be Exists; this combination means to match all values and all keys.
Key *string `json:"key,omitempty"`
// Operator represents a key's relationship to the value.
// Valid operators are Exists and Equal. Defaults to Equal.
// Valid operators are Exists, Equal, Lt, and Gt. Defaults to Equal.
// Exists is equivalent to wildcard for value, so that a pod can
// tolerate all taints of a particular category.
// Lt and Gt perform numeric comparisons (requires feature gate TaintTolerationComparisonOperators).
Operator *corev1.TolerationOperator `json:"operator,omitempty"`
// Value is the taint value the toleration matches to.
// If the operator is Exists, the value should be empty, otherwise just a regular string.

4
go.mod
View File

@@ -24,8 +24,8 @@ require (
golang.org/x/time v0.9.0
google.golang.org/protobuf v1.36.8
gopkg.in/evanphx/json-patch.v4 v4.13.0
k8s.io/api v0.0.0-20251107002836-f1737241c064
k8s.io/apimachinery v0.0.0-20251106231852-6f8949260573
k8s.io/api v0.0.0-20251111002812-16a1b565cbbf
k8s.io/apimachinery v0.0.0-20251110204254-5a348c53eef0
k8s.io/klog/v2 v2.130.1
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4

8
go.sum
View File

@@ -123,10 +123,10 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.0.0-20251107002836-f1737241c064 h1:n8Q6kd+Mwr2ce6QpIGlMKM31hhb0XkeNKKYc8mfv/pk=
k8s.io/api v0.0.0-20251107002836-f1737241c064/go.mod h1:KmeiqHqfbEx7y5cjOafexrDA1x0/NCS0EvYefr1M9eQ=
k8s.io/apimachinery v0.0.0-20251106231852-6f8949260573 h1:gNmsE5h0ynVpA5XKQBVSWKTogBPL4ecYdzF5get+L4A=
k8s.io/apimachinery v0.0.0-20251106231852-6f8949260573/go.mod h1:dR9KPaf5L0t2p9jZg/wCGB4b3ma2sXZ2zdNqILs+Sak=
k8s.io/api v0.0.0-20251111002812-16a1b565cbbf h1:0b/zJMiPTzd9w1SXnQJmOToRe5QSTIFunj6REtvzqgM=
k8s.io/api v0.0.0-20251111002812-16a1b565cbbf/go.mod h1:4cqSkQQk/TBOliV/4EGyKrjuBzosR3XlkobF5g/c68g=
k8s.io/apimachinery v0.0.0-20251110204254-5a348c53eef0 h1:uCi/FMiTM7303mfooUPf4sV2Zo049JgwqU7AMtYDFqQ=
k8s.io/apimachinery v0.0.0-20251110204254-5a348c53eef0/go.mod h1:dR9KPaf5L0t2p9jZg/wCGB4b3ma2sXZ2zdNqILs+Sak=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE=