Skip to content

Upgrade kustomize and use the set image command to patch the image name and version #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions deploy/kubernetes/base/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ spec:
serviceAccountName: csi-controller-sa
containers:
- name: csi-provisioner
image: MUSTPATCHWITHKUSTOMIZE
image: REPLACEME/csi-provisioner
args:
- "--v=5"
- "--csi-address=/csi/csi.sock"
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: csi-attacher
image: MUSTPATCHWITHKUSTOMIZE
image: REPLACEME/csi-attacher
args:
- "--v=5"
- "--csi-address=/csi/csi.sock"
volumeMounts:
- name: socket-dir
mountPath: /csi
- name: gce-pd-driver
image: MUSTPATCHWITHKUSTOMIZE
image: REPLACEME/gcp-compute-persistent-disk-csi-driver
args:
- "--v=5"
- "--endpoint=unix:/csi/csi.sock"
Expand All @@ -51,3 +51,5 @@ spec:
- name: cloud-sa-volume
secret:
secretName: cloud-sa
# This is needed due to https://github.com/kubernetes-sigs/kustomize/issues/504
volumeClaimTemplates: []
4 changes: 2 additions & 2 deletions deploy/kubernetes/base/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
serviceAccountName: csi-node-sa
containers:
- name: csi-driver-registrar
image: MUSTPATCHWITHKUSTOMIZE
image: REPLACEME/csi-node-driver-registrar
args:
- "--v=5"
- "--csi-address=/csi/csi.sock"
Expand All @@ -37,7 +37,7 @@ spec:
- name: gce-pd-driver
securityContext:
privileged: true
image: MUSTPATCHWITHKUSTOMIZE
image: REPLACEME/gcp-compute-persistent-disk-csi-driver
args:
- "--v=5"
- "--endpoint=unix:/csi/csi.sock"
Expand Down
53 changes: 0 additions & 53 deletions deploy/kubernetes/base/setup-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: external-provisioner-role
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
Expand All @@ -60,12 +57,6 @@ rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots"]
verbs: ["get", "list"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["get", "list"]

---

Expand Down Expand Up @@ -116,47 +107,3 @@ roleRef:
kind: ClusterRole
name: external-attacher-role
apiGroup: rbac.authorization.k8s.io

---
# xref: https://github.com/kubernetes-csi/external-snapshotter/blob/master/deploy/kubernetes/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: external-snapshotter-role
rules:
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["create", "get", "list", "watch", "update", "delete"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["create", "list", "watch", "delete"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["watch", "get", "list"]
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["mutatingwebhookconfigurations"]
verbs: ["create"]

---

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-controller-snapshotter-binding
subjects:
- kind: ServiceAccount
name: csi-controller-sa
namespace: default
roleRef:
kind: ClusterRole
name: external-snapshotter-role
apiGroup: rbac.authorization.k8s.io
2 changes: 1 addition & 1 deletion deploy/kubernetes/install-kustomize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ ! -f "${KUSTOMIZE_PATH}" ]; then

echo "Installing kustomize in ${KUSTOMIZE_PATH}"
opsys=linux # or darwin, or windows
curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases/tags/v1.0.8 |\
curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases/tags/v2.0.3 |\
grep browser_download |\
grep $opsys |\
cut -d '"' -f 4 |\
Expand Down
3 changes: 3 additions & 0 deletions deploy/kubernetes/overlays/alpha/WARNING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
WARNING: DO NOT USE THE ALPHA VERSION OF THE DRIVER FOR PRODUCTION

Alpha features are unsupported and may be unstable and have breaking changes across releases.
17 changes: 17 additions & 0 deletions deploy/kubernetes/overlays/alpha/controller_add_snapshotter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-gce-pd-controller
spec:
template:
spec:
containers:
- name: csi-snapshotter
imagePullPolicy: Always
image: quay.io/k8scsi/csi-snapshotter:v1.0.1
args:
- "--v=5"
- "--csi-address=/csi/csi.sock"
volumeMounts:
- name: socket-dir
mountPath: /csi
15 changes: 15 additions & 0 deletions deploy/kubernetes/overlays/alpha/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../stable
patches:
- controller_add_snapshotter.yaml
patchesJson6902:
- target:
group: rbac.authorization.k8s.io
version: v1
kind: ClusterRole
name: external-provisioner-role
path: rbac_add_snapshots_to_provisioner.yaml
resources:
- rbac_add_snapshotter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# arrays without strategic patch merge defined need to be appended
# using jsonpatch
# https://github.com/kubernetes-sigs/kustomize/blob/master/examples/jsonpatch.md
- op: add
path: /rules/-
value:
apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots"]
verbs: ["get", "list"]

- op: add
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these have to be two seperate rules? We can't consolidate them somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the syntax, I don't think it's possible to combine them. The value field is not an array

path: /rules/-
value:
apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["get", "list"]
42 changes: 42 additions & 0 deletions deploy/kubernetes/overlays/alpha/rbac_add_snapshotter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# xref: https://github.com/kubernetes-csi/external-snapshotter/blob/master/deploy/kubernetes/rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: external-snapshotter-role
rules:
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["create", "get", "list", "watch", "update", "delete"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["create", "list", "watch", "delete"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["watch", "get", "list"]
- apiGroups: ["admissionregistration.k8s.io"]
resources: ["mutatingwebhookconfigurations"]
verbs: ["create"]

---

kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: csi-controller-snapshotter-binding
subjects:
- kind: ServiceAccount
name: csi-controller-sa
namespace: default
roleRef:
kind: ClusterRole
name: external-snapshotter-role
apiGroup: rbac.authorization.k8s.io
11 changes: 11 additions & 0 deletions deploy/kubernetes/overlays/dev/controller_always_pull.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: StatefulSet
apiVersion: apps/v1
metadata:
name: csi-gce-pd-controller
spec:
template:
spec:
containers:
- name: gce-pd-driver
imagePullPolicy: Always

28 changes: 0 additions & 28 deletions deploy/kubernetes/overlays/dev/controller_images.yaml

This file was deleted.

22 changes: 19 additions & 3 deletions deploy/kubernetes/overlays/dev/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../../base
- ../alpha
patches:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the dev overlay also have the rbac_add_snapshotter.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased dev overlay on top of alpha overlay

- controller_images.yaml
- node_images.yaml
- controller_always_pull.yaml
- node_always_pull.yaml
images:
# Replace this with your private image names and tags
- name: REPLACEME/gcp-compute-persistent-disk-csi-driver
newName: gcr.io/REPLACEME/gcp-compute-persistent-disk-csi-driver
newTag: "latest"
- name: REPLACEME/csi-provisioner
newName: gcr.io/gke-release/csi-provisioner
newTag: "v1.0.1-gke.0"
- name: REPLACEME/csi-attacher
newName: gcr.io/gke-release/csi-attacher
newTag: "v1.0.1-gke.0"
- name: REPLACEME/csi-node-driver-registrar
newName: gcr.io/gke-release/csi-node-driver-registrar
newTag: "v1.0.1-gke.0"
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ spec:
containers:
- name: gce-pd-driver
imagePullPolicy: Always
image: gcr.io/dyzz-csi-staging/csi/gce-pd-driver:latest
- name: csi-driver-registrar
image: gcr.io/gke-release/csi-node-driver-registrar:v1.0.1-gke.0

14 changes: 0 additions & 14 deletions deploy/kubernetes/overlays/prow-gke-head/controller_images.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions deploy/kubernetes/overlays/prow-gke-head/kustomization.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions deploy/kubernetes/overlays/prow-gke-head/node_images.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../../base
images:
- name: REPLACEME/gcp-compute-persistent-disk-csi-driver
newName: gcr.io/gke-release-staging/gcp-compute-persistent-disk-csi-driver
newTag: "latest"
- name: REPLACEME/csi-provisioner
newName: gcr.io/gke-release-staging/csi-provisioner
newTag: "latest"
- name: REPLACEME/csi-attacher
newName: gcr.io/gke-release-staging/csi-attacher
newTag: "latest"
- name: REPLACEME/csi-node-driver-registrar
newName: gcr.io/gke-release-staging/csi-node-driver-registrar
newTag: "latest"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../../base
images:
- name: REPLACEME/gcp-compute-persistent-disk-csi-driver
newName: gcr.io/gke-release-staging/gcp-compute-persistent-disk-csi-driver
newTag: "v0.4.0-gke.0"
- name: REPLACEME/csi-provisioner
newName: gcr.io/gke-release-staging/csi-provisioner
newTag: "v1.0.1-gke.0"
- name: REPLACEME/csi-attacher
newName: gcr.io/gke-release-staging/csi-attacher
newTag: "v1.0.1-gke.0"
- name: REPLACEME/csi-node-driver-registrar
newName: gcr.io/gke-release-staging/csi-node-driver-registrar
newTag: "v1.0.1-gke.0"
14 changes: 0 additions & 14 deletions deploy/kubernetes/overlays/prow-gke-staging/controller_images.yaml

This file was deleted.

This file was deleted.

Loading