From 6e1f2b40877645a221f5cbfd70f28218bc69df8b Mon Sep 17 00:00:00 2001 From: Chinasubbareddy Mallavarapu Date: Wed, 29 Sep 2021 20:36:23 +0000 Subject: [PATCH] [ceph-provisioner] Add support to connect to rook-ceph cluster This is to add support for rook-ceph in provisioner chart so that if any clients want to connect can make use of it . Change-Id: I26c28fac3fa0f5d0b0e71a288217b37a5ca8fb13 --- ceph-provisioners/Chart.yaml | 2 +- .../provisioner/rbd/_namespace-client-key-manager.sh.tpl | 8 +++++++- ceph-provisioners/templates/job-namespace-client-key.yaml | 4 ++++ ceph-provisioners/values.yaml | 4 ++++ releasenotes/notes/ceph-provisioners.yaml | 1 + 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ceph-provisioners/Chart.yaml b/ceph-provisioners/Chart.yaml index b26c6a2b2..f96c502d7 100644 --- a/ceph-provisioners/Chart.yaml +++ b/ceph-provisioners/Chart.yaml @@ -15,6 +15,6 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Ceph Provisioner name: ceph-provisioners -version: 0.1.14 +version: 0.1.15 home: https://github.com/ceph/ceph ... diff --git a/ceph-provisioners/templates/bin/provisioner/rbd/_namespace-client-key-manager.sh.tpl b/ceph-provisioners/templates/bin/provisioner/rbd/_namespace-client-key-manager.sh.tpl index e6a8abeab..2f9fdb551 100644 --- a/ceph-provisioners/templates/bin/provisioner/rbd/_namespace-client-key-manager.sh.tpl +++ b/ceph-provisioners/templates/bin/provisioner/rbd/_namespace-client-key-manager.sh.tpl @@ -21,6 +21,12 @@ CEPH_RBD_KEY=$(kubectl get secret ${PVC_CEPH_RBD_STORAGECLASS_ADMIN_SECRET_NAME} --namespace=${PVC_CEPH_RBD_STORAGECLASS_DEPLOYED_NAMESPACE} \ -o json ) +if [[ ${CONNECT_TO_ROOK_CEPH_CLUSTER} == "true" ]] ; then + CEPH_CLUSTER_KEY=$(echo "${CEPH_RBD_KEY}" | jq -r '.data["ceph-secret"]') +else + CEPH_CLUSTER_KEY=$(echo "${CEPH_RBD_KEY}" | jq -r '.data.key') +fi + ceph_activate_namespace() { kube_namespace=$1 secret_type=$2 @@ -41,4 +47,4 @@ EOF } | kubectl apply --namespace ${kube_namespace} -f - } -ceph_activate_namespace ${DEPLOYMENT_NAMESPACE} "kubernetes.io/rbd" ${PVC_CEPH_RBD_STORAGECLASS_USER_SECRET_NAME} "$(echo ${CEPH_RBD_KEY} | jq -r '.data.key')" +ceph_activate_namespace ${DEPLOYMENT_NAMESPACE} "kubernetes.io/rbd" ${PVC_CEPH_RBD_STORAGECLASS_USER_SECRET_NAME} "${CEPH_CLUSTER_KEY}" diff --git a/ceph-provisioners/templates/job-namespace-client-key.yaml b/ceph-provisioners/templates/job-namespace-client-key.yaml index 426a8ff65..cac3204f9 100644 --- a/ceph-provisioners/templates/job-namespace-client-key.yaml +++ b/ceph-provisioners/templates/job-namespace-client-key.yaml @@ -115,6 +115,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace +{{- if eq .Values.ext_ceph_cluster.rook_ceph.connect true }} + - name: CONNECT_TO_ROOK_CEPH_CLUSTER + value: "true" +{{- end }} {{- if eq .Values.storageclass.csi_rbd.provision_storage_class true }} - name: PVC_CEPH_RBD_STORAGECLASS_USER_SECRET_NAME value: {{ .Values.storageclass.csi_rbd.parameters.userSecretName }} diff --git a/ceph-provisioners/values.yaml b/ceph-provisioners/values.yaml index 3defaed4f..9006c4fcf 100644 --- a/ceph-provisioners/values.yaml +++ b/ceph-provisioners/values.yaml @@ -302,6 +302,10 @@ conf: ms_bind_port_min: 6800 ms_bind_port_max: 7100 +ext_ceph_cluster: + rook_ceph: + connect: false + dependencies: dynamic: common: diff --git a/releasenotes/notes/ceph-provisioners.yaml b/releasenotes/notes/ceph-provisioners.yaml index 53b22da8e..ff1a75028 100644 --- a/releasenotes/notes/ceph-provisioners.yaml +++ b/releasenotes/notes/ceph-provisioners.yaml @@ -14,4 +14,5 @@ ceph-provisioners: - 0.1.12 Add ceph mon v2 port for ceph csi provisioner - 0.1.13 Fix ceph-provisioner rbd-healer error - 0.1.14 Helm 3 - Fix Job labels + - 0.1.15 Add support to connect to rook-ceph cluster ...