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: doc/design/dependency-resolution.md
+77-2Lines changed: 77 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,8 +16,83 @@ The following examples motivate why OLM's dependency resolution and upgrade stra
16
16
OLM will upgrade CRD right away if it is owned by singular CSV. If CRD is owned by multiple CSVs, then CRD is upgraded when it is
17
17
satisfied all of the following backward compatible conditions:
18
18
19
-
- All existing versions in current CRD are present in new CRD
20
-
- All existing instances (Custom Resource) of current CRD are valid when validated against new CRD's validation schema
19
+
- All existing serving versions in current CRD are present in new CRD
20
+
- All existing instances (Custom Resource) that are associated with serving versions of CRD are valid when validated against new CRD's validation schema
21
+
22
+
### Add a new version to CRD
23
+
24
+
The recommended procedure to add a new version in CRD:
25
+
26
+
1. For example, the current CRD has one version `v1alpha1` and you want to add a new version `v1beta1` and mark it as the new storage version:
27
+
28
+
```
29
+
versions:
30
+
- name: v1alpha1
31
+
served: true
32
+
storage: false
33
+
- name: v1beta1
34
+
served: true
35
+
storage: true
36
+
```
37
+
38
+
2. Ensure the referencing version of CRD in CSV is updated if CSV intends to use the new version in `owned` section:
39
+
40
+
```
41
+
customresourcedefinitions:
42
+
owned:
43
+
- name: cluster.example.com
44
+
version: v1beta1
45
+
kind: cluster
46
+
displayName: Cluster
47
+
```
48
+
49
+
3. Push the updated CRD and CSV to your bundle
50
+
51
+
### Deprecate/Remove a version of CRD
52
+
53
+
OLM will not allow a serving version of CRD to be removed right away. Instead, a deprecated version of CRD should have been disabled first by marking `Served` field in CRD to `false` first. Then, the non-serving version can be removed on the subsequent CRD upgrade.
54
+
55
+
The recommended procedure to deprecate and remove a specific version in CRD:
56
+
57
+
1. Mark the deprecated version as non-serving to indicate this version is no longer in use and may be removed in subsequent upgrade. For example:
58
+
59
+
```
60
+
versions:
61
+
- name: v1alpha1
62
+
served: false
63
+
storage: true
64
+
```
65
+
66
+
2. Switch storage version to a serving version if soon-to-deprecated version is currently the storage version.
67
+
For example:
68
+
69
+
```
70
+
versions:
71
+
- name: v1alpha1
72
+
served: false
73
+
storage: false
74
+
- name: v1beta1
75
+
served: true
76
+
storage: true
77
+
```
78
+
79
+
3. Upgrade CRD with above changes.
80
+
81
+
4. In subsequent upgrade cycles, the non-serving version can be removed completely from CRD. For example:
82
+
83
+
```
84
+
versions:
85
+
- name: v1beta1
86
+
served: true
87
+
storage: true
88
+
```
89
+
90
+
Note:
91
+
92
+
1. In order to remove a specific version that is or was storage version from CRD, that version needs to be removed from
93
+
`storedVersion` in CRD's status. OLM will attempt to do this for you if it detects a stored version no longer exists in new CRD.
94
+
95
+
2. Ensure referencing CRD's version in CSV is updated if that version is removed from the CRD.
0 commit comments