Skip to content

Commit f91162a

Browse files
authored
Merge pull request #242 from msau42/image-replacement
Upgrade kustomize and use the set image command to patch the image name and version
2 parents e717cb9 + c5b7a18 commit f91162a

32 files changed

+188
-244
lines changed

deploy/kubernetes/base/controller.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ spec:
1616
serviceAccountName: csi-controller-sa
1717
containers:
1818
- name: csi-provisioner
19-
image: MUSTPATCHWITHKUSTOMIZE
19+
image: REPLACEME/csi-provisioner
2020
args:
2121
- "--v=5"
2222
- "--csi-address=/csi/csi.sock"
2323
volumeMounts:
2424
- name: socket-dir
2525
mountPath: /csi
2626
- name: csi-attacher
27-
image: MUSTPATCHWITHKUSTOMIZE
27+
image: REPLACEME/csi-attacher
2828
args:
2929
- "--v=5"
3030
- "--csi-address=/csi/csi.sock"
3131
volumeMounts:
3232
- name: socket-dir
3333
mountPath: /csi
3434
- name: gce-pd-driver
35-
image: MUSTPATCHWITHKUSTOMIZE
35+
image: REPLACEME/gcp-compute-persistent-disk-csi-driver
3636
args:
3737
- "--v=5"
3838
- "--endpoint=unix:/csi/csi.sock"
@@ -51,3 +51,5 @@ spec:
5151
- name: cloud-sa-volume
5252
secret:
5353
secretName: cloud-sa
54+
# This is needed due to https://github.com/kubernetes-sigs/kustomize/issues/504
55+
volumeClaimTemplates: []

deploy/kubernetes/base/node.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
serviceAccountName: csi-node-sa
1616
containers:
1717
- name: csi-driver-registrar
18-
image: MUSTPATCHWITHKUSTOMIZE
18+
image: REPLACEME/csi-node-driver-registrar
1919
args:
2020
- "--v=5"
2121
- "--csi-address=/csi/csi.sock"
@@ -37,7 +37,7 @@ spec:
3737
- name: gce-pd-driver
3838
securityContext:
3939
privileged: true
40-
image: MUSTPATCHWITHKUSTOMIZE
40+
image: REPLACEME/gcp-compute-persistent-disk-csi-driver
4141
args:
4242
- "--v=5"
4343
- "--endpoint=unix:/csi/csi.sock"

deploy/kubernetes/base/setup-cluster.yaml

-53
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ apiVersion: rbac.authorization.k8s.io/v1
4545
metadata:
4646
name: external-provisioner-role
4747
rules:
48-
- apiGroups: [""]
49-
resources: ["secrets"]
50-
verbs: ["get", "list"]
5148
- apiGroups: [""]
5249
resources: ["persistentvolumes"]
5350
verbs: ["get", "list", "watch", "create", "delete"]
@@ -60,12 +57,6 @@ rules:
6057
- apiGroups: [""]
6158
resources: ["events"]
6259
verbs: ["list", "watch", "create", "update", "patch"]
63-
- apiGroups: ["snapshot.storage.k8s.io"]
64-
resources: ["volumesnapshots"]
65-
verbs: ["get", "list"]
66-
- apiGroups: ["snapshot.storage.k8s.io"]
67-
resources: ["volumesnapshotcontents"]
68-
verbs: ["get", "list"]
6960

7061
---
7162

@@ -116,47 +107,3 @@ roleRef:
116107
kind: ClusterRole
117108
name: external-attacher-role
118109
apiGroup: rbac.authorization.k8s.io
119-
120-
---
121-
# xref: https://github.com/kubernetes-csi/external-snapshotter/blob/master/deploy/kubernetes/rbac.yaml
122-
apiVersion: rbac.authorization.k8s.io/v1
123-
kind: ClusterRole
124-
metadata:
125-
name: external-snapshotter-role
126-
rules:
127-
- apiGroups: ["snapshot.storage.k8s.io"]
128-
resources: ["volumesnapshotclasses"]
129-
verbs: ["get", "list", "watch"]
130-
- apiGroups: ["snapshot.storage.k8s.io"]
131-
resources: ["volumesnapshotcontents"]
132-
verbs: ["create", "get", "list", "watch", "update", "delete"]
133-
- apiGroups: ["snapshot.storage.k8s.io"]
134-
resources: ["volumesnapshots"]
135-
verbs: ["get", "list", "watch", "update"]
136-
- apiGroups: ["apiextensions.k8s.io"]
137-
resources: ["customresourcedefinitions"]
138-
verbs: ["create", "list", "watch", "delete"]
139-
- apiGroups: [""]
140-
resources: ["events"]
141-
verbs: ["list", "watch", "create", "update", "patch"]
142-
- apiGroups: ["storage.k8s.io"]
143-
resources: ["storageclasses"]
144-
verbs: ["watch", "get", "list"]
145-
- apiGroups: ["admissionregistration.k8s.io"]
146-
resources: ["mutatingwebhookconfigurations"]
147-
verbs: ["create"]
148-
149-
---
150-
151-
kind: ClusterRoleBinding
152-
apiVersion: rbac.authorization.k8s.io/v1
153-
metadata:
154-
name: csi-controller-snapshotter-binding
155-
subjects:
156-
- kind: ServiceAccount
157-
name: csi-controller-sa
158-
namespace: default
159-
roleRef:
160-
kind: ClusterRole
161-
name: external-snapshotter-role
162-
apiGroup: rbac.authorization.k8s.io

deploy/kubernetes/install-kustomize.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if [ ! -f "${KUSTOMIZE_PATH}" ]; then
1717

1818
echo "Installing kustomize in ${KUSTOMIZE_PATH}"
1919
opsys=linux # or darwin, or windows
20-
curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases/tags/v1.0.8 |\
20+
curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases/tags/v2.0.3 |\
2121
grep browser_download |\
2222
grep $opsys |\
2323
cut -d '"' -f 4 |\
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
WARNING: DO NOT USE THE ALPHA VERSION OF THE DRIVER FOR PRODUCTION
2+
3+
Alpha features are unsupported and may be unstable and have breaking changes across releases.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
kind: StatefulSet
2+
apiVersion: apps/v1
3+
metadata:
4+
name: csi-gce-pd-controller
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: csi-snapshotter
10+
imagePullPolicy: Always
11+
image: quay.io/k8scsi/csi-snapshotter:v1.0.1
12+
args:
13+
- "--v=5"
14+
- "--csi-address=/csi/csi.sock"
15+
volumeMounts:
16+
- name: socket-dir
17+
mountPath: /csi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
bases:
4+
- ../stable
5+
patches:
6+
- controller_add_snapshotter.yaml
7+
patchesJson6902:
8+
- target:
9+
group: rbac.authorization.k8s.io
10+
version: v1
11+
kind: ClusterRole
12+
name: external-provisioner-role
13+
path: rbac_add_snapshots_to_provisioner.yaml
14+
resources:
15+
- rbac_add_snapshotter.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# arrays without strategic patch merge defined need to be appended
2+
# using jsonpatch
3+
# https://github.com/kubernetes-sigs/kustomize/blob/master/examples/jsonpatch.md
4+
- op: add
5+
path: /rules/-
6+
value:
7+
apiGroups: ["snapshot.storage.k8s.io"]
8+
resources: ["volumesnapshots"]
9+
verbs: ["get", "list"]
10+
11+
- op: add
12+
path: /rules/-
13+
value:
14+
apiGroups: ["snapshot.storage.k8s.io"]
15+
resources: ["volumesnapshotcontents"]
16+
verbs: ["get", "list"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# xref: https://github.com/kubernetes-csi/external-snapshotter/blob/master/deploy/kubernetes/rbac.yaml
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: external-snapshotter-role
6+
rules:
7+
- apiGroups: ["snapshot.storage.k8s.io"]
8+
resources: ["volumesnapshotclasses"]
9+
verbs: ["get", "list", "watch"]
10+
- apiGroups: ["snapshot.storage.k8s.io"]
11+
resources: ["volumesnapshotcontents"]
12+
verbs: ["create", "get", "list", "watch", "update", "delete"]
13+
- apiGroups: ["snapshot.storage.k8s.io"]
14+
resources: ["volumesnapshots"]
15+
verbs: ["get", "list", "watch", "update"]
16+
- apiGroups: ["apiextensions.k8s.io"]
17+
resources: ["customresourcedefinitions"]
18+
verbs: ["create", "list", "watch", "delete"]
19+
- apiGroups: [""]
20+
resources: ["events"]
21+
verbs: ["list", "watch", "create", "update", "patch"]
22+
- apiGroups: ["storage.k8s.io"]
23+
resources: ["storageclasses"]
24+
verbs: ["watch", "get", "list"]
25+
- apiGroups: ["admissionregistration.k8s.io"]
26+
resources: ["mutatingwebhookconfigurations"]
27+
verbs: ["create"]
28+
29+
---
30+
31+
kind: ClusterRoleBinding
32+
apiVersion: rbac.authorization.k8s.io/v1
33+
metadata:
34+
name: csi-controller-snapshotter-binding
35+
subjects:
36+
- kind: ServiceAccount
37+
name: csi-controller-sa
38+
namespace: default
39+
roleRef:
40+
kind: ClusterRole
41+
name: external-snapshotter-role
42+
apiGroup: rbac.authorization.k8s.io
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
kind: StatefulSet
2+
apiVersion: apps/v1
3+
metadata:
4+
name: csi-gce-pd-controller
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: gce-pd-driver
10+
imagePullPolicy: Always
11+

deploy/kubernetes/overlays/dev/controller_images.yaml

-28
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
13
bases:
2-
- ../../base
4+
- ../alpha
35
patches:
4-
- controller_images.yaml
5-
- node_images.yaml
6+
- controller_always_pull.yaml
7+
- node_always_pull.yaml
8+
images:
9+
# Replace this with your private image names and tags
10+
- name: REPLACEME/gcp-compute-persistent-disk-csi-driver
11+
newName: gcr.io/REPLACEME/gcp-compute-persistent-disk-csi-driver
12+
newTag: "latest"
13+
- name: REPLACEME/csi-provisioner
14+
newName: gcr.io/gke-release/csi-provisioner
15+
newTag: "v1.0.1-gke.0"
16+
- name: REPLACEME/csi-attacher
17+
newName: gcr.io/gke-release/csi-attacher
18+
newTag: "v1.0.1-gke.0"
19+
- name: REPLACEME/csi-node-driver-registrar
20+
newName: gcr.io/gke-release/csi-node-driver-registrar
21+
newTag: "v1.0.1-gke.0"

deploy/kubernetes/overlays/dev/node_images.yaml renamed to deploy/kubernetes/overlays/dev/node_always_pull.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ spec:
88
containers:
99
- name: gce-pd-driver
1010
imagePullPolicy: Always
11-
image: gcr.io/dyzz-csi-staging/csi/gce-pd-driver:latest
12-
- name: csi-driver-registrar
13-
image: gcr.io/gke-release/csi-node-driver-registrar:v1.0.1-gke.0
11+

deploy/kubernetes/overlays/prow-gke-head/controller_images.yaml

-14
This file was deleted.

deploy/kubernetes/overlays/prow-gke-head/kustomization.yaml

-5
This file was deleted.

deploy/kubernetes/overlays/prow-gke-head/node_images.yaml

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
bases:
4+
- ../../base
5+
images:
6+
- name: REPLACEME/gcp-compute-persistent-disk-csi-driver
7+
newName: gcr.io/gke-release-staging/gcp-compute-persistent-disk-csi-driver
8+
newTag: "latest"
9+
- name: REPLACEME/csi-provisioner
10+
newName: gcr.io/gke-release-staging/csi-provisioner
11+
newTag: "latest"
12+
- name: REPLACEME/csi-attacher
13+
newName: gcr.io/gke-release-staging/csi-attacher
14+
newTag: "latest"
15+
- name: REPLACEME/csi-node-driver-registrar
16+
newName: gcr.io/gke-release-staging/csi-node-driver-registrar
17+
newTag: "latest"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
bases:
4+
- ../../base
5+
images:
6+
- name: REPLACEME/gcp-compute-persistent-disk-csi-driver
7+
newName: gcr.io/gke-release-staging/gcp-compute-persistent-disk-csi-driver
8+
newTag: "v0.4.0-gke.0"
9+
- name: REPLACEME/csi-provisioner
10+
newName: gcr.io/gke-release-staging/csi-provisioner
11+
newTag: "v1.0.1-gke.0"
12+
- name: REPLACEME/csi-attacher
13+
newName: gcr.io/gke-release-staging/csi-attacher
14+
newTag: "v1.0.1-gke.0"
15+
- name: REPLACEME/csi-node-driver-registrar
16+
newName: gcr.io/gke-release-staging/csi-node-driver-registrar
17+
newTag: "v1.0.1-gke.0"

deploy/kubernetes/overlays/prow-gke-staging/controller_images.yaml

-14
This file was deleted.

deploy/kubernetes/overlays/prow-gke-staging/kustomization.yaml

-5
This file was deleted.

0 commit comments

Comments
 (0)