From 7c4e2ef8bcbabd29fe9109b752d329a49f66c8fc Mon Sep 17 00:00:00 2001 From: Chinasubbareddy M Date: Tue, 4 Sep 2018 12:44:35 -0500 Subject: [PATCH] Ceph provisioners: Make configmap and job names configurable This is to make sure configmap and job names will not get conflict if we are trying to activate any nameapce for two diffrent ceph cluster's client keys Change-Id: I8360f642a6d25f2af0d7aaea686adefef838821a --- ceph-provisioners/templates/configmap-bin-provisioner.yaml | 2 +- ceph-provisioners/templates/configmap-bin.yaml | 2 +- ceph-provisioners/templates/configmap-etc-client.yaml | 2 +- .../templates/deployment-cephfs-provisioner.yaml | 2 +- ceph-provisioners/templates/deployment-rbd-provisioner.yaml | 2 +- ceph-provisioners/templates/job-bootstrap.yaml | 4 ++-- ceph-provisioners/templates/job-cephfs-client-key.yaml | 2 +- .../templates/job-namespace-client-key-cleaner.yaml | 6 +++--- ceph-provisioners/templates/job-namespace-client-key.yaml | 6 +++--- ceph-provisioners/values.yaml | 1 + 10 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ceph-provisioners/templates/configmap-bin-provisioner.yaml b/ceph-provisioners/templates/configmap-bin-provisioner.yaml index d34870fba3..3163d50ad6 100644 --- a/ceph-provisioners/templates/configmap-bin-provisioner.yaml +++ b/ceph-provisioners/templates/configmap-bin-provisioner.yaml @@ -20,7 +20,7 @@ limitations under the License. apiVersion: v1 kind: ConfigMap metadata: - name: ceph-provisioners-bin-clients + name: {{ printf "%s-%s" $envAll.Release.Name "ceph-prov-bin-clients" | quote }} data: provisioner-rbd-namespace-client-key-manager.sh: | {{ tuple "bin/provisioner/rbd/_namespace-client-key-manager.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} diff --git a/ceph-provisioners/templates/configmap-bin.yaml b/ceph-provisioners/templates/configmap-bin.yaml index ed735d790d..21e145d70b 100644 --- a/ceph-provisioners/templates/configmap-bin.yaml +++ b/ceph-provisioners/templates/configmap-bin.yaml @@ -20,7 +20,7 @@ limitations under the License. apiVersion: v1 kind: ConfigMap metadata: - name: ceph-provisioners-bin + name: {{ printf "%s-%s" $envAll.Release.Name "ceph-prov-bin" | quote }} data: {{- if .Values.images.local_registry.active }} image-repo-sync.sh: | diff --git a/ceph-provisioners/templates/configmap-etc-client.yaml b/ceph-provisioners/templates/configmap-etc-client.yaml index e3001bd686..da0ae5c143 100644 --- a/ceph-provisioners/templates/configmap-etc-client.yaml +++ b/ceph-provisioners/templates/configmap-etc-client.yaml @@ -52,5 +52,5 @@ data: {{- end }} {{- end }} {{- if .Values.manifests.configmap_etc }} -{{- list "ceph-etc" . | include "ceph.configmap.etc" }} +{{- list .Values.storageclass.rbd.ceph_configmap_name . | include "ceph.configmap.etc" }} {{- end }} diff --git a/ceph-provisioners/templates/deployment-cephfs-provisioner.yaml b/ceph-provisioners/templates/deployment-cephfs-provisioner.yaml index 4830fba4e9..5096de8902 100644 --- a/ceph-provisioners/templates/deployment-cephfs-provisioner.yaml +++ b/ceph-provisioners/templates/deployment-cephfs-provisioner.yaml @@ -173,6 +173,6 @@ spec: volumes: - name: ceph-provisioners-bin configMap: - name: ceph-provisioners-bin + name: {{ printf "%s-%s" $envAll.Release.Name "ceph-prov-bin" | quote }} defaultMode: 0555 {{- end }} diff --git a/ceph-provisioners/templates/deployment-rbd-provisioner.yaml b/ceph-provisioners/templates/deployment-rbd-provisioner.yaml index 99c7e3016b..dd0788b3d8 100644 --- a/ceph-provisioners/templates/deployment-rbd-provisioner.yaml +++ b/ceph-provisioners/templates/deployment-rbd-provisioner.yaml @@ -163,6 +163,6 @@ spec: volumes: - name: ceph-provisioners-bin configMap: - name: ceph-provisioners-bin + name: {{ printf "%s-%s" $envAll.Release.Name "ceph-prov-bin" | quote }} defaultMode: 0555 {{- end }} diff --git a/ceph-provisioners/templates/job-bootstrap.yaml b/ceph-provisioners/templates/job-bootstrap.yaml index 00c4737368..30e45ff5ca 100644 --- a/ceph-provisioners/templates/job-bootstrap.yaml +++ b/ceph-provisioners/templates/job-bootstrap.yaml @@ -58,11 +58,11 @@ spec: volumes: - name: ceph-provisioners-bin configMap: - name: ceph-provisioners-bin + name: {{ printf "%s-%s" $envAll.Release.Name "ceph-prov-bin" | quote }} defaultMode: 0555 - name: ceph-etc configMap: - name: ceph-etc + name: {{ .Values.storageclass.rbd.ceph_configmap_name }} defaultMode: 0444 - name: ceph-client-admin-keyring secret: diff --git a/ceph-provisioners/templates/job-cephfs-client-key.yaml b/ceph-provisioners/templates/job-cephfs-client-key.yaml index 2b0bee5a5b..be5f747796 100644 --- a/ceph-provisioners/templates/job-cephfs-client-key.yaml +++ b/ceph-provisioners/templates/job-cephfs-client-key.yaml @@ -119,6 +119,6 @@ spec: volumes: - name: ceph-provisioners-bin configMap: - name: ceph-provisioners-bin + name: {{ printf "%s-%s" $envAll.Release.Name "ceph-prov-bin" | quote }} defaultMode: 0555 {{- end }} diff --git a/ceph-provisioners/templates/job-namespace-client-key-cleaner.yaml b/ceph-provisioners/templates/job-namespace-client-key-cleaner.yaml index f0691fc5c4..dfb4fa5d0a 100644 --- a/ceph-provisioners/templates/job-namespace-client-key-cleaner.yaml +++ b/ceph-provisioners/templates/job-namespace-client-key-cleaner.yaml @@ -19,7 +19,7 @@ limitations under the License. {{- $randStringSuffix := randAlphaNum 5 | lower }} -{{- $serviceAccountName := print "ceph-namespace-client-key-cleaner-" $randStringSuffix }} +{{- $serviceAccountName := print $envAll.Release.Name "-ceph-ns-key-cleaner" }} {{ tuple $envAll "namespace_client_key_cleaner" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: rbac.authorization.k8s.io/v1beta1 @@ -52,7 +52,7 @@ subjects: apiVersion: batch/v1 kind: Job metadata: - name: ceph-namespace-client-key-cleaner-{{ $randStringSuffix }} + name: {{ $serviceAccountName }} annotations: "helm.sh/hook": pre-delete spec: @@ -88,6 +88,6 @@ spec: volumes: - name: ceph-provisioners-bin-clients configMap: - name: ceph-provisioners-bin-clients + name: {{ printf "%s-%s" $envAll.Release.Name "ceph-prov-bin-clients" | quote }} defaultMode: 0555 {{- end }} diff --git a/ceph-provisioners/templates/job-namespace-client-key.yaml b/ceph-provisioners/templates/job-namespace-client-key.yaml index 75fd06872e..855995eebe 100644 --- a/ceph-provisioners/templates/job-namespace-client-key.yaml +++ b/ceph-provisioners/templates/job-namespace-client-key.yaml @@ -19,7 +19,7 @@ limitations under the License. {{- $randStringSuffix := randAlphaNum 5 | lower }} -{{- $serviceAccountName := "ceph-namespace-client-key-generator" }} +{{- $serviceAccountName := print $envAll.Release.Name "-ceph-ns-key-generator" }} {{ tuple $envAll "namespace_client_key_generator" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: rbac.authorization.k8s.io/v1beta1 @@ -81,7 +81,7 @@ subjects: apiVersion: batch/v1 kind: Job metadata: - name: ceph-namespace-client-key-generator + name: {{ $serviceAccountName }} spec: template: metadata: @@ -119,6 +119,6 @@ spec: volumes: - name: ceph-provisioners-bin-clients configMap: - name: ceph-provisioners-bin-clients + name: {{ printf "%s-%s" $envAll.Release.Name "ceph-prov-bin-clients" | quote }} defaultMode: 0555 {{- end }} diff --git a/ceph-provisioners/values.yaml b/ceph-provisioners/values.yaml index feb817e7d0..b5eb3c34ff 100644 --- a/ceph-provisioners/values.yaml +++ b/ceph-provisioners/values.yaml @@ -176,6 +176,7 @@ storageclass: monitors: null pool: rbd admin_id: admin + ceph_configmap_name: ceph-etc admin_secret_name: pvc-ceph-conf-combined-storageclass admin_secret_namespace: ceph user_id: admin