Skip to content

Commit a5b0f7b

Browse files
authored
Merge pull request #25597 from apelisse/clarify-preserve-unknown
Clarify compatibility guarantees around spec.preserveUnknownFields
2 parents 3deb4e2 + fb1a0ca commit a5b0f7b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,18 @@ CustomResourceDefinitions store validated resource data in the cluster's persist
314314
{{< note >}}
315315
CRDs converted from `apiextensions.k8s.io/v1beta1` to `apiextensions.k8s.io/v1` might lack structural schemas, and `spec.preserveUnknownFields` might be `true`.
316316

317-
For migrated CustomResourceDefinitions where `spec.preserveUnknownFields` is set, pruning is _not_ enabled and you can store arbitrary data. For best compatibility, you should update your custom resources to meet an OpenAPI schema, and you should set `spec.preserveUnknownFields` to true for the CustomResourceDefinition itself.
317+
For legacy CustomResourceDefinition objects created as
318+
`apiextensions.k8s.io/v1beta1` with `spec.preserveUnknownFields` set to
319+
`true`, the following is also true:
320+
321+
* Pruning is not enabled.
322+
* You can store arbitrary data.
323+
324+
For compatibility with `apiextensions.k8s.io/v1`, update your custom
325+
resource definitions to:
326+
327+
1. Use a structural OpenAPI schema.
328+
2. Set `spec.preserveUnknownFields` to `false`.
318329
{{< /note >}}
319330

320331
If you save the following YAML to `my-crontab.yaml`:

0 commit comments

Comments
 (0)