Ceph: Add labels to secrets created by charts

This PS adds labels to secrets created by charts, which allows them
to be easily identified in deployed sites.

PS4: This PS resolves undefined variable "$envAll" issue

Change-Id: Icbe3584b0ac18b23e32489c4a04ad5aa7aad67e6
Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
Pete Birley 2018-11-01 16:43:17 -05:00 committed by Krishna Venkata
parent 0a4a76797d
commit 90700f5a76
4 changed files with 14 additions and 0 deletions

View File

@ -19,6 +19,7 @@ limitations under the License.
set -ex set -ex
{{ if .Release.IsInstall }} {{ if .Release.IsInstall }}
{{- $envAll := . }}
function ceph_gen_key () { function ceph_gen_key () {
python ${CEPH_GEN_DIR}/keys-bootstrap-keyring-generator.py python ${CEPH_GEN_DIR}/keys-bootstrap-keyring-generator.py
@ -43,6 +44,8 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: ${KUBE_SECRET_NAME} name: ${KUBE_SECRET_NAME}
labels:
{{ tuple $envAll "ceph" "bootstrap" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
type: Opaque type: Opaque
data: data:
${CEPH_KEYRING_NAME}: $( kube_ceph_keyring_gen ${CEPH_KEYRING} ${CEPH_KEYRING_TEMPLATE} ) ${CEPH_KEYRING_NAME}: $( kube_ceph_keyring_gen ${CEPH_KEYRING} ${CEPH_KEYRING_TEMPLATE} )

View File

@ -18,6 +18,7 @@ limitations under the License.
set -ex set -ex
{{ if .Release.IsInstall }} {{ if .Release.IsInstall }}
{{- $envAll := . }}
function ceph_gen_key () { function ceph_gen_key () {
python ${CEPH_GEN_DIR}/keys-bootstrap-keyring-generator.py python ${CEPH_GEN_DIR}/keys-bootstrap-keyring-generator.py
@ -45,6 +46,8 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: ${KUBE_SECRET_NAME} name: ${KUBE_SECRET_NAME}
labels:
{{ tuple $envAll "ceph" "admin" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
type: Opaque type: Opaque
data: data:
${CEPH_KEYRING_NAME}: $( kube_ceph_keyring_gen ${CEPH_KEYRING} ${CEPH_KEYRING_TEMPLATE} ) ${CEPH_KEYRING_NAME}: $( kube_ceph_keyring_gen ${CEPH_KEYRING} ${CEPH_KEYRING_TEMPLATE} )
@ -67,6 +70,8 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: ${KUBE_SECRET_NAME} name: ${KUBE_SECRET_NAME}
labels:
{{ tuple $envAll "ceph" "admin" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
type: kubernetes.io/rbd type: kubernetes.io/rbd
data: data:
key: $( echo ${CEPH_KEYRING} | base64 | tr -d '\n' ) key: $( echo ${CEPH_KEYRING} | base64 | tr -d '\n' )

View File

@ -17,6 +17,7 @@ limitations under the License.
*/}} */}}
set -ex set -ex
{{- $envAll := . }}
CEPH_CEPHFS_KEY=$(kubectl get secret ${PVC_CEPH_CEPHFS_STORAGECLASS_ADMIN_SECRET_NAME} \ CEPH_CEPHFS_KEY=$(kubectl get secret ${PVC_CEPH_CEPHFS_STORAGECLASS_ADMIN_SECRET_NAME} \
--namespace=${PVC_CEPH_CEPHFS_STORAGECLASS_DEPLOYED_NAMESPACE} \ --namespace=${PVC_CEPH_CEPHFS_STORAGECLASS_DEPLOYED_NAMESPACE} \
@ -33,6 +34,8 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: "${secret_name}" name: "${secret_name}"
labels:
{{ tuple $envAll "ceph" "cephfs" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
type: "${secret_type}" type: "${secret_type}"
data: data:
key: $( echo ${ceph_key} ) key: $( echo ${ceph_key} )

View File

@ -17,6 +17,7 @@ limitations under the License.
*/}} */}}
set -ex set -ex
{{- $envAll := . }}
CEPH_RBD_KEY=$(kubectl get secret ${PVC_CEPH_RBD_STORAGECLASS_ADMIN_SECRET_NAME} \ CEPH_RBD_KEY=$(kubectl get secret ${PVC_CEPH_RBD_STORAGECLASS_ADMIN_SECRET_NAME} \
--namespace=${PVC_CEPH_RBD_STORAGECLASS_DEPLOYED_NAMESPACE} \ --namespace=${PVC_CEPH_RBD_STORAGECLASS_DEPLOYED_NAMESPACE} \
@ -33,6 +34,8 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: "${secret_name}" name: "${secret_name}"
labels:
{{ tuple $envAll "ceph" "rbd" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
type: "${secret_type}" type: "${secret_type}"
data: data:
key: $( echo ${ceph_key} ) key: $( echo ${ceph_key} )