Name: cinder-bin Namespace: openstack Labels: app.kubernetes.io/managed-by=Helm Annotations: meta.helm.sh/release-name: cinder meta.helm.sh/release-namespace: openstack Data ==== backup-storage-init.sh: ---- #!/bin/bash set -x if [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.ceph' ]]; then SECRET=$(mktemp --suffix .yaml) KEYRING=$(mktemp --suffix .keyring) function cleanup { rm -f ${SECRET} ${KEYRING} } trap cleanup EXIT fi set -ex if [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.swift' ]] || \ [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.posix' ]]; then echo "INFO: no action required to use $STORAGE_BACKEND" elif [[ $STORAGE_BACKEND =~ 'cinder.backup.drivers.ceph' ]]; then ceph -s function ensure_pool () { ceph osd pool stats $1 || ceph osd pool create $1 $2 if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -ge 12 ]]; then ceph osd pool application enable $1 $3 fi size_protection=$(ceph osd pool get $1 nosizechange | cut -f2 -d: | tr -d '[:space:]') ceph osd pool set $1 nosizechange 0 ceph osd pool set $1 size ${RBD_POOL_REPLICATION} --yes-i-really-mean-it ceph osd pool set $1 nosizechange ${size_protection} ceph osd pool set $1 crush_rule "${RBD_POOL_CRUSH_RULE}" } ensure_pool ${RBD_POOL_NAME} ${RBD_POOL_CHUNK_SIZE} ${RBD_POOL_APP_NAME} if USERINFO=$(ceph auth get client.${RBD_POOL_USER}); then echo "Cephx user client.${RBD_POOL_USER} already exists" echo "Update its cephx caps" ceph auth caps client.${RBD_POOL_USER} \ mon "profile rbd" \ osd "profile rbd pool=${RBD_POOL_NAME}" ceph auth get client.${RBD_POOL_USER} -o ${KEYRING} else ceph auth get-or-create client.${RBD_POOL_USER} \ mon "profile rbd" \ osd "profile rbd pool=${RBD_POOL_NAME}" \ -o ${KEYRING} fi ENCODED_KEYRING=$(sed -n 's/^[[:blank:]]*key[[:blank:]]\+=[[:blank:]]\(.*\)/\1/p' ${KEYRING} | base64 -w0) cat > ${SECRET} < /tmp/rmq_definitions.json rabbitmqadmin_cli import /tmp/rmq_definitions.json fi storage-init.sh: ---- #!/bin/bash set -x if [ "x$STORAGE_BACKEND" == "xcinder.volume.drivers.rbd.RBDDriver" ]; then SECRET=$(mktemp --suffix .yaml) KEYRING=$(mktemp --suffix .keyring) function cleanup { rm -f ${SECRET} ${KEYRING} } trap cleanup EXIT fi set -ex if [ "x$STORAGE_BACKEND" == "xcinder.volume.drivers.rbd.RBDDriver" ]; then ceph -s function ensure_pool () { ceph osd pool stats $1 || ceph osd pool create $1 $2 if [[ $(ceph mgr versions | awk '/version/{print $3}' | cut -d. -f1) -ge 12 ]]; then ceph osd pool application enable $1 $3 fi size_protection=$(ceph osd pool get $1 nosizechange | cut -f2 -d: | tr -d '[:space:]') ceph osd pool set $1 nosizechange 0 ceph osd pool set $1 size ${RBD_POOL_REPLICATION} --yes-i-really-mean-it ceph osd pool set $1 nosizechange ${size_protection} ceph osd pool set $1 crush_rule "${RBD_POOL_CRUSH_RULE}" } ensure_pool ${RBD_POOL_NAME} ${RBD_POOL_CHUNK_SIZE} ${RBD_POOL_APP_NAME} if USERINFO=$(ceph auth get client.${RBD_POOL_USER}); then echo "Cephx user client.${RBD_POOL_USER} already exist." echo "Update its cephx caps" ceph auth caps client.${RBD_POOL_USER} \ mon "profile rbd" \ osd "profile rbd" ceph auth get client.${RBD_POOL_USER} -o ${KEYRING} else #NOTE(JCL): Restrict Cinder permissions to what is needed. MON Read only and RBD access to Cinder pool only. ceph auth get-or-create client.${RBD_POOL_USER} \ mon "profile rbd" \ osd "profile rbd" \ -o ${KEYRING} fi ENCODED_KEYRING=$(sed -n 's/^[[:blank:]]*key[[:blank:]]\+=[[:blank:]]\(.*\)/\1/p' ${KEYRING} | base64 -w0) cat > ${SECRET} < /tmp/rally-config.json << EOF { "openstack": { "auth_url": "${OS_AUTH_URL}", "region_name": "${OS_REGION_NAME}", "endpoint_type": "${OS_INTERFACE}", "admin": { "username": "${OS_USERNAME}", "password": "${OS_PASSWORD}", "user_domain_name": "${OS_USER_DOMAIN_NAME}", "project_name": "${OS_PROJECT_NAME}", "project_domain_name": "${OS_PROJECT_DOMAIN_NAME}" }, "users": [ { "username": "${SERVICE_OS_USERNAME}", "password": "${SERVICE_OS_PASSWORD}", "project_name": "${SERVICE_OS_PROJECT_NAME}", "user_domain_name": "${SERVICE_OS_USER_DOMAIN_NAME}", "project_domain_name": "${SERVICE_OS_PROJECT_DOMAIN_NAME}" } ], "https_insecure": false, "https_cacert": "${OS_CACERT}" } } EOF rally deployment create --file /tmp/rally-config.json --name "${RALLY_ENV_NAME}" rm -f /tmp/rally-config.json rally deployment use "${RALLY_ENV_NAME}" rally deployment check rally task validate /etc/rally/rally_tests.yaml rally task start /etc/rally/rally_tests.yaml rally task sla-check rally env cleanup rally deployment destroy --deployment "${RALLY_ENV_NAME}" retrieve-internal-tenant.sh: ---- #!/bin/bash set -ex USER_PROJECT_ID=$(openstack project show -f value -c id \ "${INTERNAL_PROJECT_NAME}"); USER_ID=$(openstack user show -f value -c id \ "${INTERNAL_USER_NAME}"); tee /tmp/pod-shared/internal_tenant.conf < /etc/ceph/ceph.client.admin.keyring [client.admin] key = $(cat /tmp/client-keyring) EOF exit 0 ceph-keyring.sh: ---- #!/bin/bash set -ex export HOME=/tmp cat < /etc/ceph/ceph.client.${RBD_USER}.keyring [client.${RBD_USER}] key = $(cat /tmp/client-keyring) EOF exit 0 clean-secrets.sh: ---- #!/bin/bash set -ex exec kubectl delete secret \ --namespace ${NAMESPACE} \ --ignore-not-found=true \ ${RBD_POOL_SECRET} volume-usage-audit.sh: ---- #!/bin/bash set -ex exec cinder-volume-usage-audit --send_actions BinaryData ==== Events: