You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: keps/sig-api-machinery/20190425-crd-conversion-webhook.md
+21-7Lines changed: 21 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,12 @@ authors:
6
6
owning-sig: sig-api-machinery
7
7
participating-sigs:
8
8
reviewers:
9
-
- "@dbsmith"
9
+
- "@lavalamp"
10
10
- "@deads2k"
11
11
- "@sttts"
12
-
- "@liggit"
13
-
- "@enisoc"
12
+
- "@liggitt"
14
13
approvers:
15
-
- "@dbsmith"
14
+
- "@lavalamp"
16
15
- "@deads2k"
17
16
creation-date: 2019-04-25
18
17
last-updated: 2019-04-25
@@ -155,7 +154,7 @@ type CustomResourceDefinitionVersion struct {
155
154
}
156
155
157
156
Type CustomResourceConversionstruct {
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.
159
158
Strategystring
160
159
161
160
// 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
176
175
* 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.
177
176
* 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.
178
177
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:
180
179
181
180
*v1beta1->v1:*
182
181
@@ -678,7 +677,7 @@ And create it:
678
677
Kubectl create -f cr2.yaml
679
678
```
680
679
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.
682
681
683
682
**Step 5 alternative**: create a crd1-b.yaml that has v2 but not served.
684
683
@@ -736,8 +735,23 @@ Consider including folks that also work outside the SIG or subproject.
736
735
737
736
## Graduation Criteria
738
737
738
+
v1beta1:
739
739
740
740
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
+
741
755
## Implementation History
742
756
743
757
- Implemented in Kubernetes 1.13 release (https://github.com/kubernetes/kubernetes/pull/67006)
0 commit comments