Ceph: update namespace client key script to hard fail sucessfully

This PS updates the ceph namespace client key script to hard fail
if it cannot get the admin storage key from the namespace ceph is
deployed into.

Change-Id: Ieefe6d800a678d721294561b25bbebc874cfa74d
This commit is contained in:
Pete Birley 2017-08-22 11:12:04 -05:00
parent dd132eaf9d
commit 39509c1eb5

View File

@ -20,6 +20,9 @@ set -ex
ceph_activate_namespace() { ceph_activate_namespace() {
kube_namespace=$1 kube_namespace=$1
CEPH_KEY=$(kubectl get secret ${PVC_CEPH_STORAGECLASS_ADMIN_SECRET_NAME} \
--namespace=${PVC_CEPH_STORAGECLASS_DEPLOYED_NAMESPACE} \
-o json | jq -r '.data | .[]')
{ {
cat <<EOF cat <<EOF
apiVersion: v1 apiVersion: v1
@ -29,9 +32,7 @@ metadata:
type: kubernetes.io/rbd type: kubernetes.io/rbd
data: data:
key: | key: |
$(kubectl get secret ${PVC_CEPH_STORAGECLASS_ADMIN_SECRET_NAME} \ $(echo ${CEPH_KEY})
--namespace=${PVC_CEPH_STORAGECLASS_DEPLOYED_NAMESPACE} \
-o json | jq -r '.data | .[]')
EOF EOF
} | kubectl create --namespace ${kube_namespace} -f - } | kubectl create --namespace ${kube_namespace} -f -
} }