From d4c4954c9d8007e071696e64901b04cb6fa55c65 Mon Sep 17 00:00:00 2001 From: Kevin Fox Date: Fri, 10 Apr 2020 08:55:21 -0700 Subject: [PATCH] Support externally managed configmap. https://github.com/ceph/ceph-csi/issues/927 Signed-off-by: Kevin Fox --- charts/ceph-csi-cephfs/templates/csiplugin-configmap.yaml | 2 ++ charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml | 5 +++++ charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml | 5 +++++ charts/ceph-csi-cephfs/values.yaml | 4 ++++ charts/ceph-csi-rbd/templates/csiplugin-configmap.yaml | 2 ++ charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml | 5 +++++ charts/ceph-csi-rbd/templates/provisioner-deployment.yaml | 5 +++++ charts/ceph-csi-rbd/values.yaml | 4 ++++ 8 files changed, 32 insertions(+) diff --git a/charts/ceph-csi-cephfs/templates/csiplugin-configmap.yaml b/charts/ceph-csi-cephfs/templates/csiplugin-configmap.yaml index de0072321..1f59b66ce 100644 --- a/charts/ceph-csi-cephfs/templates/csiplugin-configmap.yaml +++ b/charts/ceph-csi-cephfs/templates/csiplugin-configmap.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.externallyManagedConfigmap }} apiVersion: v1 kind: ConfigMap metadata: @@ -12,3 +13,4 @@ metadata: data: config.json: |- {{ toJson .Values.csiConfig | indent 4 -}} +{{- end }} diff --git a/charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml b/charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml index ad75700e2..47911c8c3 100644 --- a/charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml +++ b/charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml @@ -187,6 +187,11 @@ spec: - name: ceph-csi-config configMap: name: {{ .Values.configMapName | quote }} +{{- if .Values.configMapKey }} + items: + - key: {{ .Values.configMapKey | quote }} + path: config.json +{{- end }} - name: keys-tmp-dir emptyDir: { medium: "Memory" diff --git a/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml b/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml index 615a77fb4..0c61fe7c6 100644 --- a/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml +++ b/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml @@ -173,6 +173,11 @@ spec: - name: ceph-csi-config configMap: name: {{ .Values.configMapName | quote }} +{{- if .Values.configMapKey }} + items: + - key: {{ .Values.configMapKey | quote }} + path: config.json +{{- end }} - name: keys-tmp-dir emptyDir: { medium: "Memory" diff --git a/charts/ceph-csi-cephfs/values.yaml b/charts/ceph-csi-cephfs/values.yaml index 659bbd78f..22e021bd2 100644 --- a/charts/ceph-csi-cephfs/values.yaml +++ b/charts/ceph-csi-cephfs/values.yaml @@ -183,3 +183,7 @@ pluginDir: /var/lib/kubelet/plugins driverName: cephfs.csi.ceph.com # Name of the configmap used for state configMapName: ceph-csi-config-cephfs +# Key to use in the Configmap if not config.json +configMapKey: +# Use an externally provided configmap +externallyManagedConfigmap: false diff --git a/charts/ceph-csi-rbd/templates/csiplugin-configmap.yaml b/charts/ceph-csi-rbd/templates/csiplugin-configmap.yaml index bfc366b3e..67cb22f1a 100644 --- a/charts/ceph-csi-rbd/templates/csiplugin-configmap.yaml +++ b/charts/ceph-csi-rbd/templates/csiplugin-configmap.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.externallyManagedConfigmap }} apiVersion: v1 kind: ConfigMap metadata: @@ -12,3 +13,4 @@ metadata: data: config.json: |- {{ toJson .Values.csiConfig | indent 4 -}} +{{- end }} diff --git a/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml b/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml index 4eadae442..7eb5dd972 100644 --- a/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml +++ b/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml @@ -186,6 +186,11 @@ spec: - name: ceph-csi-config configMap: name: {{ .Values.configMapName | quote }} +{{- if .Values.configMapKey }} + items: + - key: {{ .Values.configMapKey | quote }} + path: config.json +{{- end }} - name: ceph-csi-encryption-kms-config configMap: name: {{ .Values.kmsConfigMapName | quote }} diff --git a/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml b/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml index 243e997f5..8b7c72296 100644 --- a/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml +++ b/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml @@ -190,6 +190,11 @@ spec: - name: ceph-csi-config configMap: name: {{ .Values.configMapName | quote }} +{{- if .Values.configMapKey }} + items: + - key: {{ .Values.configMapKey | quote }} + path: config.json +{{- end }} - name: ceph-csi-encryption-kms-config configMap: name: {{ .Values.kmsConfigMapName | quote }} diff --git a/charts/ceph-csi-rbd/values.yaml b/charts/ceph-csi-rbd/values.yaml index f11c3941a..a1cdd899c 100644 --- a/charts/ceph-csi-rbd/values.yaml +++ b/charts/ceph-csi-rbd/values.yaml @@ -200,5 +200,9 @@ pluginDir: /var/lib/kubelet/plugins driverName: rbd.csi.ceph.com # Name of the configmap used for state configMapName: ceph-csi-config-rbd +# Key to use in the Configmap if not config.json +configMapKey: +# Use an externally provided configmap +externallyManagedConfigmap: false # Name of the configmap used for encryption kms configuration kmsConfigMapName: ceph-csi-encryption-kms-config