-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Enhancement Description
-
One-line enhancement description (can be used as a release note): Pruning for Custom Resources
-
Kubernetes Enhancement Proposal:
CustomResources store arbitrary JSON data without following the typical Kubernetes API behaviour to prune unknown fields. This makes CRDs different, but also leads to security and general data consistency concerns because it is unclear what is actually stored in etcd.
This KEP proposes to add pruning of all fields which are not specified in the OpenAPI validation schemas given in the CRD.
Pruning will be opt-in in v1beta1 of apiextensions.k8s.io via
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
spec:
preserveUnknownFields: false
...i.e. CRDs created in v1beta1 default to disabled pruning.
Pruning will be enabled for every CRD created in v1 and we will hide preserveUnknownFields in v1 in that case.
Pruning can be disabled for subtrees of CustomResources by setting the x-kubernetes-preserve-unknown-fields: true vendor extension. This allows to store arbitrary JSON or RawExtensions. This will even be possible at the root level, even in v1. Adding that in every to each object in a schema leads to the old behaviour.
Pruning requires structural schemas (as described in KEP Vanilla OpenAPI Subset: Structural Schema) for all defined versions. Validation will reject the CRD with preserveUnknownFields: false otherwise.
-
Discussion Link:
-
Primary contact (assignee): @sttts
-
Responsible SIGs: sig-api-machinery
-
Enhancement target (which target equals to which milestone):
- Alpha release target (x.y):
- Beta release target (x.y):
- Stable release target (x.y):
-
Alpha
- KEP (
k/enhancements) update PR(s): - Code (
k/k) update PR(s): - Docs (
k/website) update PR(s):
- KEP (
Please keep this description up to date. This will help the Enhancement Team to track the evolution of the enhancement efficiently.