From 6f73d4e3ca6cf464fd7a28208968f34d054ba0c3 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 (cherry picked from commit d4c4954c9d8007e071696e64901b04cb6fa55c65) --- 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 782d2cad0..66f2bd1a0 100644 --- a/charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.yaml +++ b/charts/ceph-csi-cephfs/templates/nodeplugin-daemonset.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: 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 b48dff1d2..c1b0a746f 100644 --- a/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml +++ b/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml @@ -176,6 +176,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 a3e8ef0b7..d9931a31f 100644 --- a/charts/ceph-csi-cephfs/values.yaml +++ b/charts/ceph-csi-cephfs/values.yaml @@ -195,3 +195,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 6bb693dfd..89ad83542 100644 --- a/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml +++ b/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml @@ -189,6 +189,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 c622ca49c..2129285e0 100644 --- a/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml +++ b/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml @@ -193,6 +193,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 c3caef445..3830db511 100644 --- a/charts/ceph-csi-rbd/values.yaml +++ b/charts/ceph-csi-rbd/values.yaml @@ -212,5 +212,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