From c6b4e477237f43959ffcd4f37cbfad9cb6e08934 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 2 Apr 2019 16:51:42 +0530 Subject: [PATCH] add if condition for attacher adding the condition will help us to easily remove the attacher later. or even we can add else condition if we have an alternate to attacher. Signed-off-by: Madhu Rajanna --- deploy/cephfs/helm/templates/provisioner-clusterrole.yaml | 2 ++ deploy/cephfs/helm/templates/provisioner-statefulset.yaml | 2 ++ deploy/cephfs/helm/values.yaml | 2 +- deploy/rbd/helm/templates/provisioner-clusterrole.yaml | 2 ++ deploy/rbd/helm/templates/provisioner-statefulset.yaml | 2 ++ deploy/rbd/helm/values.yaml | 2 +- 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/deploy/cephfs/helm/templates/provisioner-clusterrole.yaml b/deploy/cephfs/helm/templates/provisioner-clusterrole.yaml index 186b21ff5..99f446766 100644 --- a/deploy/cephfs/helm/templates/provisioner-clusterrole.yaml +++ b/deploy/cephfs/helm/templates/provisioner-clusterrole.yaml @@ -34,7 +34,9 @@ rules: - apiGroups: [""] resources: ["nodes"] verbs: ["get", "list", "watch"] + {{ if .Values.attacher.enabled }} - apiGroups: ["storage.k8s.io"] resources: ["volumeattachments"] verbs: ["get", "list", "watch", "update"] + {{ end }} {{- end -}} diff --git a/deploy/cephfs/helm/templates/provisioner-statefulset.yaml b/deploy/cephfs/helm/templates/provisioner-statefulset.yaml index 4fb0b7b82..2bef74612 100644 --- a/deploy/cephfs/helm/templates/provisioner-statefulset.yaml +++ b/deploy/cephfs/helm/templates/provisioner-statefulset.yaml @@ -41,6 +41,7 @@ spec: mountPath: {{ .Values.socketDir }} resources: {{ toYaml .Values.provisioner.resources | indent 12 }} + {{ if .Values.attacher.enabled }} - name: csi-attacher image: "{{ .Values.attacher.image.repository }}:{{ .Values.attacher.image.tag }}" args: @@ -53,6 +54,7 @@ spec: volumeMounts: - name: socket-dir mountPath: {{ .Values.socketDir }} + {{ end }} - name: csi-cephfsplugin securityContext: privileged: true diff --git a/deploy/cephfs/helm/values.yaml b/deploy/cephfs/helm/values.yaml index b31c9733e..cfc64fe54 100644 --- a/deploy/cephfs/helm/values.yaml +++ b/deploy/cephfs/helm/values.yaml @@ -20,7 +20,7 @@ volumeDevicesDir: /var/lib/kubelet/plugins/kubernetes.io/csi/volumeDevices driverName: cephfs.csi.ceph.com attacher: name: attacher - + enabled: true replicaCount: 1 image: diff --git a/deploy/rbd/helm/templates/provisioner-clusterrole.yaml b/deploy/rbd/helm/templates/provisioner-clusterrole.yaml index 3e39e5a88..a4f7fcbba 100644 --- a/deploy/rbd/helm/templates/provisioner-clusterrole.yaml +++ b/deploy/rbd/helm/templates/provisioner-clusterrole.yaml @@ -34,9 +34,11 @@ rules: - apiGroups: ["snapshot.storage.k8s.io"] resources: ["volumesnapshots"] verbs: ["get", "list", "watch", "update"] + {{ if .Values.attacher.enabled }} - apiGroups: ["storage.k8s.io"] resources: ["volumeattachments"] verbs: ["get", "list", "watch", "update"] + {{ end }} - apiGroups: ["snapshot.storage.k8s.io"] resources: ["volumesnapshotcontents"] verbs: ["create", "get", "list", "watch", "update", "delete"] diff --git a/deploy/rbd/helm/templates/provisioner-statefulset.yaml b/deploy/rbd/helm/templates/provisioner-statefulset.yaml index 89c87b4fa..6ebdfc388 100644 --- a/deploy/rbd/helm/templates/provisioner-statefulset.yaml +++ b/deploy/rbd/helm/templates/provisioner-statefulset.yaml @@ -58,6 +58,7 @@ spec: mountPath: {{ .Values.socketDir }} resources: {{ toYaml .Values.snapshotter.resources | indent 12 }} + {{ if .Values.attacher.enabled }} - name: csi-attacher image: "{{ .Values.attacher.image.repository }}:{{ .Values.attacher.image.tag }}" args: @@ -70,6 +71,7 @@ spec: volumeMounts: - name: socket-dir mountPath: {{ .Values.socketDir }} + {{ end }} - name: csi-rbdplugin securityContext: privileged: true diff --git a/deploy/rbd/helm/values.yaml b/deploy/rbd/helm/values.yaml index fdeb5d6d5..9d14fa19e 100644 --- a/deploy/rbd/helm/values.yaml +++ b/deploy/rbd/helm/values.yaml @@ -21,7 +21,7 @@ driverName: rbd.csi.ceph.com attacher: name: attacher - + enabled: true replicaCount: 1 image: