@@ -719,12 +719,13 @@ crontab "my-new-cron-object" created
719
719
` ` `
720
720
# ## Validation ratcheting
721
721
722
- {{< feature-state state="alpha" for_k8s_version="v1.28 " >}}
722
+ {{< feature-state feature_gate_name="CRDValidationRatcheting " >}}
723
723
724
- You need to enable the `CRDValidationRatcheting`
724
+ If you are using a version of Kubernetes older than v1.30, you need to explicitly
725
+ enable the `CRDValidationRatcheting`
725
726
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) to
726
727
use this behavior, which then applies to all CustomResourceDefinitions in your
727
- cluster.
728
+ cluster.
728
729
729
730
Provided you enabled the feature gate, Kubernetes implements _validation racheting_
730
731
for CustomResourceDefinitions. The API server is willing to accept updates to resources that
@@ -751,10 +752,12 @@ validations are not supported by ratcheting under the implementation in Kubernet
751
752
- ` x-kubernetes-validations`
752
753
For Kubernetes 1.28, CRD validation rules](#validation-rules) are ignored by
753
754
ratcheting. Starting with Alpha 2 in Kubernetes 1.29, `x-kubernetes-validations`
754
- are ratcheted.
755
+ are ratcheted only if they do not refer to `oldSelf` .
755
756
756
757
Transition Rules are never ratcheted : only errors raised by rules that do not
757
- use `oldSelf` will be automatically ratcheted if their values are unchanged.
758
+ use `oldSelf` will be automatically ratcheted if their values are unchanged.
759
+
760
+ To write custom ratcheting logic for CEL expressions, check out [optionalOldSelf](#field-optional-oldself).
758
761
- ` x-kubernetes-list-type`
759
762
Errors arising from changing the list type of a subschema will not be
760
763
ratcheted. For example adding `set` onto a list with duplicates will always
@@ -772,8 +775,10 @@ validations are not supported by ratcheting under the implementation in Kubernet
772
775
To remove a previously specified `additionalProperties` validation will not be
773
776
ratcheted.
774
777
- ` metadata`
775
- Errors arising from changes to fields within an object's `metadata` are not
776
- ratcheted.
778
+ Errors that come from Kubernetes' built-in validation of an object's `metadata`
779
+ are not ratcheted (such as object name, or characters in a label value).
780
+ If you specify your own additional rules for the metadata of a custom resource,
781
+ that additional validation will be ratcheted.
777
782
778
783
# ## Validation rules
779
784
@@ -1177,10 +1182,11 @@ Setting `fieldPath` is optional.
1177
1182
1178
1183
# ### The `optionalOldSelf` field {#field-optional-oldself}
1179
1184
1180
- {{< feature-state state="alpha" for_k8s_version="v1.29 " >}}
1185
+ {{< feature-state feature_gate_name="CRDValidationRatcheting " >}}
1181
1186
1182
- The feature [CRDValidationRatcheting](#validation-ratcheting) must be enabled in order to
1183
- make use of this field.
1187
+ If your cluster does not have [CRD validation ratcheting](#validation-ratcheting) enabled,
1188
+ the CustomResourceDefinition API doesn't include this field, and trying to set it may result
1189
+ in an error.
1184
1190
1185
1191
The `optionalOldSelf` field is a boolean field that alters the behavior of [Transition Rules](#transition-rules) described
1186
1192
below. Normally, a transition rule will not evaluate if `oldSelf` cannot be determined :
0 commit comments