Skip to content

Commit 78956f8

Browse files
authored
Merge pull request #45264 from alexzielenski/4008-beta2
KEP-4008: CRDValidationRacheting - Beta Docs
2 parents cbf0322 + 251c470 commit 78956f8

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

content/en/docs/reference/command-line-tools-reference/feature-gates/crd-validation-ratcheting.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ stages:
99
- stage: alpha
1010
defaultValue: false
1111
fromVersion: "1.28"
12+
toVersion: "1.29"
13+
- stage: beta
14+
defaultValue: true
15+
fromVersion: "1.30"
1216
---
1317
Enable updates to custom resources to contain
1418
violations of their OpenAPI schema if the offending portions of the resource

content/en/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -719,12 +719,13 @@ crontab "my-new-cron-object" created
719719
```
720720
### Validation ratcheting
721721

722-
{{< feature-state state="alpha" for_k8s_version="v1.28" >}}
722+
{{< feature-state feature_gate_name="CRDValidationRatcheting" >}}
723723

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`
725726
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) to
726727
use this behavior, which then applies to all CustomResourceDefinitions in your
727-
cluster.
728+
cluster.
728729

729730
Provided you enabled the feature gate, Kubernetes implements _validation racheting_
730731
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
751752
- `x-kubernetes-validations`
752753
For Kubernetes 1.28, CRD validation rules](#validation-rules) are ignored by
753754
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`.
755756

756757
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).
758761
- `x-kubernetes-list-type`
759762
Errors arising from changing the list type of a subschema will not be
760763
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
772775
To remove a previously specified `additionalProperties` validation will not be
773776
ratcheted.
774777
- `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.
777782

778783
### Validation rules
779784

@@ -1177,10 +1182,11 @@ Setting `fieldPath` is optional.
11771182

11781183
#### The `optionalOldSelf` field {#field-optional-oldself}
11791184

1180-
{{< feature-state state="alpha" for_k8s_version="v1.29" >}}
1185+
{{< feature-state feature_gate_name="CRDValidationRatcheting" >}}
11811186

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.
11841190

11851191
The `optionalOldSelf` field is a boolean field that alters the behavior of [Transition Rules](#transition-rules) described
11861192
below. Normally, a transition rule will not evaluate if `oldSelf` cannot be determined:

0 commit comments

Comments
 (0)