Skip to content

Commit c76f69e

Browse files
committed
Documentation part 1 for overlays
1 parent 597524e commit c76f69e

File tree

1 file changed

+192
-0
lines changed

1 file changed

+192
-0
lines changed

docs/release/overlays.md

+192
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# Overview of per kubernetes minor version overlays
2+
3+
The Persistent Disk CSI Driver manifest [bundle](../../deploy/kubernetes/base) is a set of many kubernetes resources (driver pod which includes the containers csi-provisioner, csi-resizer, csi-snapshotter, gce-pd-driver, csi-driver-registrar; csi driver object, rbacs, pod security policies etc). Not all driver capabilties can be used with all kubernetes versions. For example [volume snapshots](https://kubernetes.io/docs/concepts/storage/volume-snapshots/) are supported on 1.17+ kubernetes versions. Thus structuring the overlays on a per kubernetes minor version is beneficial to quickly identify driver capabilities supported for a given minor version of kubernetes (example [stable-1-16](../../deploy/kubernetes/overlays/stable-1-16) driver manifests does not contain the snapshotter sidecar), and facilitates easy maintenance/updates of the CSI driver. The master branch has the up-to-date [overlays](https://github.com/kubernetes-sigs/gcp-compute-persistent-disk-csi-driver/tree/master/deploy/kubernetes/overlays) for each kubernetes version, which specify which driver release version to use with each kubernetes version.
4+
5+
Example:
6+
`stable-1-19` [overlays](../../deploy/kubernetes/overlays/stable-1-19) bundle can be used to deploy all the components of the driver on kubernetes 1.19. This overlay uses persistent disk driver release version [1.2.0](../../deploy/kubernetes/images/stable-1-19/image.yaml).
7+
`prow-gke-staging-release-rc-1-19` [overlays](../../deploy/kubernetes/overlays/prow-gke-staging-release-rc-1-19) bundle can be used to test all the components of the driver on kubernetes 1.19.
8+
9+
## General guidelines for creation/modification of new/existing overlays
10+
11+
When it comes to creation of overlays there are no strict rules on how overlays must be created/modified but the following captures some of the common scenarios of adding new capabilities to the CSI driver bundle and how it would affect the overlays creation/modification.
12+
13+
1. Creating a new k8s minor version overlay with an existing released driver image
14+
* Consider a scenario where we have existing overlays `stable-1-18`, `stable-master`. We plan to now create a new overlay for k8s 1.19
15+
* Create a new `deploy/kubernetes/images/prow-gke-staging-release-rc-1-19` directory with appropriate image versions. If the images used in `stable-master` or `stable-1-18` are compatible with 1.19, we can clone from either `deploy/kubernetes/images/stable-master/image.yaml` or `deploy/kubernetes/images/stable-1-18/image.yaml`
16+
* Create a new `deploy/kubernetes/overlays/prow-gke-staging-release-rc-1-19` directory and clone contents from either `deploy/kubernetes/overlays/stable-master/*` or `deploy/kubernetes/overlays/stable-1-18/*`, depending on which manifests would be compatible with the 1.19 driver bundle and add the necessary kustomize diff patches to `deploy/kubernetes/overlays/stable-1-19/*`.
17+
* At this stage, follow the validation steps as mentioned in the scenario above to verify `prow-gke-release-staging-rc-1-19` driver bundle. Care must be taken to avoid directly making changes to `deploy/kubernetes/base` manifests at this stage, as they may impact existing overlays.
18+
19+
A sample kustomize patch file would look like this:
20+
21+
```
22+
deploy/kubernetes/overlays/prow-gke-release-staging-rc-1-19/your-1-19-kustomize-diff-patch.yaml
23+
```
24+
25+
In deploy/kubernetes/overlays/prow-gke-release-staging-rc-1-19/kustomize.yaml,
26+
27+
```
28+
apiVersion: kustomize.config.k8s.io/v1beta1
29+
kind: Kustomization
30+
resources:
31+
- ../stable-master (If this 1.19 overlay is created based out of stable-master)
32+
patchesStrategicMerge: # or any other patch strategies (such as JsonPatches6902)
33+
- <your-1-19-kustomize-diff-patch.yaml>
34+
transformers:
35+
- ../../images/prow-gke-release-staging-rc-1-19
36+
```
37+
38+
* When `prow-gke-release-staging-rc-1-19` is validated, we have couple of options to update the stable-1-19. If the kustomize diffs are a one-off change specific to 1.19, we can simply move the kustomize patches to stable-1-19. The kustomize patch file would now look like this.
39+
40+
```
41+
$ mv deploy/kubernetes/overlays/prow-gke-release-staging-rc-1-19/your-1-19-kustomize-diff-patch.yaml deploy/kubernetes/overlays/stable-1-19/your-1-19-kustomize-diff-patch.yaml
42+
```
43+
44+
For `stable-1-19`,
45+
```
46+
apiVersion: kustomize.config.k8s.io/v1beta1
47+
kind: Kustomization
48+
namespace:
49+
gce-pd-csi-driver
50+
resources:
51+
- ../../base/controller
52+
- ../../base/node_linux
53+
patchesStrategicMerge: # or any other patch strategies (such as JsonPatches6902)
54+
- <your-1-19-kustomize-diff-patch.yaml>
55+
transformers:
56+
- ../../images/stable-1-19
57+
```
58+
59+
For `prow-gke-release-staging-rc-1-19`,
60+
```
61+
apiVersion: kustomize.config.k8s.io/v1beta1
62+
kind: Kustomization
63+
resources:
64+
- ../stable-1-19
65+
transformers:
66+
- ../../images/prow-gke-release-staging-rc-1-19
67+
```
68+
69+
* If the changes are long term, make the changes to `deploy/kubernetes/base`, add the appropriate diff to remove the changes from the overlays less than `stable-1-19`. The overlay kustomize would look something like this
70+
71+
For `stable-1-19`,
72+
```
73+
apiVersion: kustomize.config.k8s.io/v1beta1
74+
kind: Kustomization
75+
namespace:
76+
gce-pd-csi-driver
77+
resources:
78+
- ../../base
79+
# no patches needed since changes merged to deploy/kubernetes/base
80+
transformers:
81+
- ../../images/stable-1-19
82+
```
83+
84+
For `prow-gke-release-staging-rc-1-19`,
85+
```
86+
apiVersion: kustomize.config.k8s.io/v1beta1
87+
kind: Kustomization
88+
resources:
89+
- ../stable-1-19
90+
transformers:
91+
- ../../images/prow-gke-release-staging-rc-1-19
92+
```
93+
94+
For `stable-1-18` and older overlays,
95+
```
96+
apiVersion: kustomize.config.k8s.io/v1beta1
97+
kind: Kustomization
98+
namespace:
99+
gce-pd-csi-driver
100+
resources:
101+
- ../../base
102+
patchesStrategicMerge: # or any other patch strategies (such as JsonPatches6902)
103+
- <your-1-18-kustomize-diff-remove-1-19-changes-patch.yaml>
104+
transformers:
105+
- ../../images/stable-1-18
106+
```
107+
108+
2. Sidecar image version update for existing overlays
109+
* Consider a scenario where we have three existing stable overlays `stable-1-17`, `stable-1-18`, `stable-master`. Sidecar S1 is available 1.17+, S2 is available 1.18+. If we need to upgrade the image versions for these sidecars, we would do the following:
110+
* Update the `deploy/kubernetes/images/prow-gke-staging-release-rc-1-17` for sidecar S1, `deploy/kubernetes/images/prow-gke-staging-release-rc-1-18` and `deploy/kubernetes/images/prow-gke-staging-release-rc-master` for S1 and S2.
111+
* Validate the changes made to the staging overlays. Ensure the upstream testgrids like [this](https://k8s-testgrid.appspot.com/provider-gcp-compute-persistent-disk-csi-driver) are green, and verify with repository maintainers that downstream test grids (e.g GKE internal prow test grids) are green.
112+
* Now update `deploy/kubernetes/images/stable-1-17` for sidecar S1, and `deploy/kubernetes/images/stable-1-18`, `deploy/kubernetes/images/stable-master` for sidecar S1 and S2. Repository maintainers should ensure that any internal downstream testgrids are green before approving the pull request to merge changes to a stable overlay.
113+
114+
3. Sidecar spec changes
115+
* Consider a scenario where a sidecar S1 has version V1 in 1.17 and V2 in 1.18. V2 introcudes a new capability via a new arg 'new-flag' (and say this flag deprecates 'old-flag'). To introduce this change, first we make changes to the `deploy/kubernetes/images/prow-gke-staging-release-rc-1-18` sidecar spec.
116+
117+
For `prow-gke-staging-release-rc-1-18` overlay,
118+
```
119+
apiVersion: kustomize.config.k8s.io/v1beta1
120+
kind: Kustomization
121+
resources:
122+
- ../stable-1-18
123+
patchesStrategicMerge: # or any other patch strategies (such as JsonPatches6902)
124+
- <your-1-18-kustomize-diff-patch-for-new-sidecar-spec.yaml>
125+
transformers:
126+
- ../../images/prow-gke-release-staging-rc-1-18
127+
```
128+
129+
* Validate the changes made to the staging overlays. Ensure the upstream testgrids like [this](https://k8s-testgrid.appspot.com/provider-gcp-compute-persistent-disk-csi-driver) are green, and verify with repository maintainers that downstream test grids (e.g GKE internal prow test grids) are green.
130+
* Now to merge the change to stable overlay, we incorporate the change in deploy/kubernetes/base,
131+
132+
```
133+
containers:
134+
- name: <your-sidecar>
135+
...
136+
args:
137+
- "--new-flag" # --old-flag deleted.
138+
```
139+
140+
*
141+
For `stable-1-18`,
142+
```
143+
apiVersion: kustomize.config.k8s.io/v1beta1
144+
kind: Kustomization
145+
namespace:
146+
gce-pd-csi-driver
147+
resources:
148+
- ../../base
149+
# no patches needed since changes merged to deploy/kubernetes/base
150+
transformers:
151+
- ../../images/stable-1-18
152+
```
153+
154+
For `prow-gke-release-staging-rc-1-18`,
155+
```
156+
apiVersion: kustomize.config.k8s.io/v1beta1
157+
kind: Kustomization
158+
resources:
159+
- ../stable-1-18
160+
transformers:
161+
- ../../images/prow-gke-release-staging-rc-1-18
162+
```
163+
164+
For `stable-1-17` and older overlays,
165+
```
166+
apiVersion: kustomize.config.k8s.io/v1beta1
167+
kind: Kustomization
168+
namespace:
169+
gce-pd-csi-driver
170+
resources:
171+
- ../../base
172+
patchesStrategicMerge: # or any other patch strategies (such as JsonPatches6902)
173+
- <your-1-17-kustomize-diff-patch-to-replace-new-flag-with-old-flag.yaml>
174+
transformers:
175+
- ../../images/stable-1-17
176+
```
177+
178+
4. Driver image update
179+
* If we have released a new driver image version, update the `deploy/kubernetes/images/prow-gke-release-staging-rc-{k8s-minor}/image.yaml` and `deploy/kubernetes/images/prow-gke-release-staging-rc-master/image.yaml`, for whichever k8s minor version are compatible with the new driver image version.
180+
* Validate the staging drivers and then make changes to the `deploy/kubernetes/images/stable-{k8s-minor}/image.yaml`and `deploy/kubernetes/images/stable-master/image.yaml`
181+
182+
5. Cutting new releases
183+
* With the master branch maintaining the stable-x.y overlays, the master branch stable overlays can always be the referenced to pick the latest and greatest stable driver manifest bundle.
184+
* At the time of cutting a release branch (e.g release-1.0), we should ensure that the release branch has valid overlays bundle for all the k8s minor versions the driver supports, and tests running against the release branch will work. As the master branch moves forward, the release branch is still valid (but not necessarily up-to-date). For the most up-to-date manifests, refer to the master stable-x.y overlays.
185+
* GKE managed driver changes will be pulled from the master branch stable-x.y overlays.
186+
* As the master branch moves forward (changes to sidecars etc), we should cherry-pick changes to an older release branch only on a need basis. Possible cases of cherrypick:
187+
188+
1. Critical bug fixes on the core driver.
189+
190+
2. If a critical bug fix involves multiple components (driver and sidecar), cherry-pick all the changes to the older release branch.
191+
192+
After a change has been cherry-picked to a release branch, a new patch release will have to be cut on that branch, and the overlays would be updated to reflect the new driver image version. Check release process [here](../../release-tools/README.md)

0 commit comments

Comments
 (0)