Skip to content

Commit 95951eb

Browse files
committed
Add CRD conversion webhook to v1beta1 criteria to KEP
1 parent 130460d commit 95951eb

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

keps/sig-api-machinery/20190425-crd-conversion-webhook.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ authors:
66
owning-sig: sig-api-machinery
77
participating-sigs:
88
reviewers:
9-
- "@dbsmith"
9+
- "@lavalamp"
1010
- "@deads2k"
1111
- "@sttts"
12-
- "@liggit"
13-
- "@enisoc"
12+
- "@liggitt"
1413
approvers:
15-
- "@dbsmith"
14+
- "@lavalamp"
1615
- "@deads2k"
1716
creation-date: 2019-04-25
1817
last-updated: 2019-04-25
@@ -155,7 +154,7 @@ type CustomResourceDefinitionVersion struct {
155154
}
156155

157156
Type CustomResourceConversion struct {
158-
// Conversion strategy, either "nop or "webhook. If webhook is set, Webhook field is required.
157+
// Conversion strategy, either "nop" or "webhook". If webhook is set, Webhook field is required.
159158
Strategy string
160159

161160
// Additional information for external conversion if strategy is set to external
@@ -176,7 +175,7 @@ In *CRD v1beta1* (apiextensions.k8s.io/v1beta1) there are per-version schema, ad
176175
* Either top level X or per-version X can be set, but not both. This rule applies to individual X’s not the whole set. E.g. top level schema can be set while per-version subresources are set.
177176
* per-version X cannot be the same. E.g. if all per-version schema are the same, the CRD object will be rejected with an error message asking the user to use the top level schema.
178177

179-
in *CRD v1* (apiextensions.k8s.io/v1), there will be only version list with no top level X. The second validation guarantees a clean moving to v1. These are conversion rules:
178+
In *CRD v1* (apiextensions.k8s.io/v1), there will be only version list with no top level X. The second validation guarantees a clean moving to v1. These are conversion rules:
180179

181180
*v1beta1->v1:*
182181

@@ -678,7 +677,7 @@ And create it:
678677
Kubectl create -f cr2.yaml
679678
```
680679
681-
**Step 5**: storage now has two custom resources in two different versions. To downgrade to previous CRD, one can apply crd1.yaml but that will fail as the status.storedVersions has both v1 and v2 and those cannot be removed from the spec.versions list. To downgrade, first create a crd2-b.yaml file that sets v1 as storage version and apply it, then follow "*Upgrade existing objects to a new stored version* in [this document](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definition-versioning/). After all CRs in the storage has v1 version, you can apply crd1.yaml.
680+
**Step 5**: storage now has two custom resources in two different versions. To downgrade to previous CRD, one can apply crd1.yaml but that will fail as the status.storedVersions has both v1 and v2 and those cannot be removed from the spec.versions list. To downgrade, first create a crd2-b.yaml file that sets v1 as storage version and apply it, then follow "*Upgrade existing objects to a new stored version*" in [this document](https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definition-versioning/). After all CRs in the storage has v1 version, you can apply crd1.yaml.
682681
683682
**Step 5 alternative**: create a crd1-b.yaml that has v2 but not served.
684683
@@ -736,8 +735,23 @@ Consider including folks that also work outside the SIG or subproject.
736735
737736
## Graduation Criteria
738737
738+
v1beta1:
739739
740740
741+
- Ensure the scenarios from (https://github.com/kubernetes/kubernetes/issues/64136) are tested:
742+
- Ensure what is persisted in etcd matches the storage version
743+
- Set up a CRD, persist some data, change the storage version, and ensure the previously persisted data is readable
744+
- Ensure discovery docs track a CRD through creation, version addition, version removal, and deletion
745+
- Ensure `spec.served` is respected
746+
747+
v1:
748+
749+
- ConversionReview API v1 is stable (including fields that need to be updated for v1beta1 or v1)
750+
- Documented step-by-step CRD version migration workflow that covers the entire
751+
process of migrating from one version to another (introduce a new CRD version,
752+
add the converter, migrate clients, migrate to new storage version, all the
753+
way to removing the old version)
754+
741755
## Implementation History
742756
743757
- Implemented in Kubernetes 1.13 release (https://github.com/kubernetes/kubernetes/pull/67006)

0 commit comments

Comments
 (0)