From d342ac40cb6e0628c4ee1b4950130a05246908c5 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Thu, 10 May 2018 23:40:42 -0500 Subject: [PATCH] Ceph: Setup radosgw with increased swift support. This PS updates the cephs config to deploy radosgw with greater swift compatibility. Allowing clients to use RGW as though it were a real swift deployment. Change-Id: Id0a27b42b7f9c0c9e4b5a197ef50feb612e6adfc --- ceph-client/values.yaml | 10 ++-- ceph-mon/values.yaml | 4 +- cinder/values.yaml | 4 +- glance/templates/bin/_storage-init.sh.tpl | 53 +++++++++++-------- glance/templates/job-storage-init.yaml | 7 +++ glance/values.yaml | 21 +++++++- gnocchi/values.yaml | 2 +- ironic/templates/bin/_ironic-api.sh.tpl | 1 + ironic/templates/bin/_ironic-conductor.sh.tpl | 1 + .../bin/_retreive-swift-config.sh.tpl | 35 ++++++++++++ ironic/templates/configmap-bin.yaml | 2 + ironic/templates/configmap-etc.yaml | 16 +++--- ironic/templates/deployment-api.yaml | 19 +++++++ ironic/templates/secret-keystone.yaml | 2 +- ironic/templates/statefulset-conductor.yaml | 19 +++++++ ironic/values.yaml | 50 ++++++++++------- .../{080-keystone.sh => 070-keystone.sh} | 0 .../baremetal/080-ceph-radosgateway.sh | 1 + tools/deployment/developer/ceph/120-glance.sh | 2 +- tools/gate/playbooks/ironic-deploy.yaml | 8 ++- tools/images/ceph-config-helper/Dockerfile | 14 +++-- tools/images/ceph-config-helper/Makefile | 2 +- tools/images/ceph-config-helper/README.rst | 2 +- 23 files changed, 208 insertions(+), 67 deletions(-) create mode 100644 ironic/templates/bin/_retreive-swift-config.sh.tpl rename tools/deployment/baremetal/{080-keystone.sh => 070-keystone.sh} (100%) create mode 120000 tools/deployment/baremetal/080-ceph-radosgateway.sh diff --git a/ceph-client/values.yaml b/ceph-client/values.yaml index 3877feb7ae..88804a57c2 100644 --- a/ceph-client/values.yaml +++ b/ceph-client/values.yaml @@ -26,10 +26,10 @@ images: tags: ceph_bootstrap: 'docker.io/ceph/daemon:tag-build-master-luminous-ubuntu-16.04' ceph_cephfs_provisioner: 'quay.io/external_storage/cephfs-provisioner:v0.1.1' - ceph_config_helper: 'docker.io/port/ceph-config-helper:v1.10.1' + ceph_config_helper: 'docker.io/port/ceph-config-helper:v1.10.2' ceph_mds: 'docker.io/ceph/daemon:tag-build-master-luminous-ubuntu-16.04' ceph_mgr: 'docker.io/ceph/daemon:tag-build-master-luminous-ubuntu-16.04' - ceph_rbd_pool: 'docker.io/port/ceph-config-helper:v1.10.1' + ceph_rbd_pool: 'docker.io/port/ceph-config-helper:v1.10.2' ceph_rbd_provisioner: 'quay.io/external_storage/rbd-provisioner:v0.1.1' ceph_rgw: 'docker.io/ceph/daemon:tag-build-master-luminous-ubuntu-16.04' dep_check: 'quay.io/stackanetes/kubernetes-entrypoint:v0.3.1' @@ -275,8 +275,10 @@ conf: config: rgw_keystone_api_version: 3 rgw_keystone_accepted_roles: "admin, _member_" - rgw_keystone_implicit_tenants: true + rgw_keystone_implicit_tenants: false + rgw_keystone_make_new_tenants: true rgw_s3_auth_use_keystone: true + rgw_swift_account_in_url: true ceph: global: # auth @@ -488,7 +490,7 @@ endpoints: host_fqdn_override: default: null path: - default: /swift/v1 + default: /swift/v1/KEY_$(tenant_id)s scheme: default: http port: diff --git a/ceph-mon/values.yaml b/ceph-mon/values.yaml index ba0a5a442d..8c7719e9ad 100644 --- a/ceph-mon/values.yaml +++ b/ceph-mon/values.yaml @@ -20,9 +20,9 @@ images: pull_policy: IfNotPresent tags: ceph_bootstrap: 'docker.io/ceph/daemon:tag-build-master-luminous-ubuntu-16.04' - ceph_config_helper: 'docker.io/port/ceph-config-helper:v1.10.1' + ceph_config_helper: 'docker.io/port/ceph-config-helper:v1.10.2' ceph_mon: 'docker.io/ceph/daemon:tag-build-master-luminous-ubuntu-16.04' - ceph_mon_check: 'docker.io/port/ceph-config-helper:v1.10.1' + ceph_mon_check: 'docker.io/port/ceph-config-helper:v1.10.2' dep_check: 'quay.io/stackanetes/kubernetes-entrypoint:v0.3.0' image_repo_sync: docker.io/docker:17.07.0 local_registry: diff --git a/cinder/values.yaml b/cinder/values.yaml index 415f8f1310..6826e7be0a 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -56,9 +56,9 @@ images: cinder_scheduler: docker.io/openstackhelm/cinder:newton cinder_volume: docker.io/openstackhelm/cinder:newton cinder_volume_usage_audit: docker.io/openstackhelm/cinder:newton - cinder_storage_init: docker.io/ceph/daemon:tag-build-master-luminous-ubuntu-16.04 + cinder_storage_init: docker.io/port/ceph-config-helper:v1.10.2 cinder_backup: docker.io/openstackhelm/cinder:newton - cinder_backup_storage_init: docker.io/ceph/daemon:tag-build-master-luminous-ubuntu-16.04 + cinder_backup_storage_init: docker.io/port/ceph-config-helper:v1.10.2 dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1 image_repo_sync: docker.io/docker:17.07.0 pull_policy: "IfNotPresent" diff --git a/glance/templates/bin/_storage-init.sh.tpl b/glance/templates/bin/_storage-init.sh.tpl index a4a0609040..1ca016e14c 100644 --- a/glance/templates/bin/_storage-init.sh.tpl +++ b/glance/templates/bin/_storage-init.sh.tpl @@ -21,65 +21,74 @@ if [ "x$STORAGE_BACKEND" == "xrbd" ]; then SECRET=$(mktemp --suffix .yaml) KEYRING=$(mktemp --suffix .keyring) function cleanup { - rm -f ${SECRET} ${KEYRING} + rm -f "${SECRET}" "${KEYRING}" } trap cleanup EXIT fi set -ex -if [ "x$STORAGE_BACKEND" == "xpvc" ] || [ "x$STORAGE_BACKEND" == "xswift" ]; then +if [ "x$STORAGE_BACKEND" == "xpvc" ]; then echo "No action required." +elif [ "x$STORAGE_BACKEND" == "xswift" ]; then + OS_TOKEN="$(openstack token issue -f value -c id)" + OS_PROJECT_ID="$(openstack project show service -f value -c id)" + OS_SWIFT_ENDPOINT_PREFIX="$(openstack endpoint list --service swift --interface public -f value -c URL | awk -F '$' '{ print $1 }')" + OS_SWIFT_SCOPED_ENDPOINT="${OS_SWIFT_ENDPOINT_PREFIX}${OS_PROJECT_ID}" + curl -i -X POST "${OS_SWIFT_SCOPED_ENDPOINT}" \ + -H "X-Auth-Token: ${OS_TOKEN}" \ + -H "X-Account-Meta-Temp-URL-Key: ${SWIFT_TMPURL_KEY}" elif [ "x$STORAGE_BACKEND" == "xrbd" ]; then ceph -s function ensure_pool () { - ceph osd pool stats $1 || ceph osd pool create $1 $2 - local test_luminous=$(ceph tell osd.* version | egrep -c "12.2|luminous") + ceph osd pool stats "$1" || ceph osd pool create "$1" "$2" + local test_luminous + test_luminous=$(ceph tell osd.* version | egrep -c "12.2|luminous") if [[ ${test_luminous} -gt 0 ]]; then - ceph osd pool application enable $1 $3 + ceph osd pool application enable "$1" "$3" fi } - ensure_pool ${RBD_POOL_NAME} ${RBD_POOL_CHUNK_SIZE} "glance-image" + ensure_pool "${RBD_POOL_NAME}" "${RBD_POOL_CHUNK_SIZE}" "glance-image" - if USERINFO=$(ceph auth get client.${RBD_POOL_USER}); then - KEYSTR=$(echo $USERINFO | sed 's/.*\( key = .*\) caps mon.*/\1/') - echo $KEYSTR > ${KEYRING} + if USERINFO=$(ceph auth get "client.${RBD_POOL_USER}"); then + KEYSTR=$(echo "${USERINFO}" | sed 's/.*\( key = .*\) caps mon.*/\1/') + echo "${KEYSTR}" > "${KEYRING}" else #NOTE(Portdirect): Determine proper privs to assign keyring - ceph auth get-or-create client.${RBD_POOL_USER} \ + ceph auth get-or-create "client.${RBD_POOL_USER}" \ mon "allow *" \ osd "allow *" \ mgr "allow *" \ - -o ${KEYRING} + -o "${KEYRING}" fi - ENCODED_KEYRING=$(sed -n 's/^[[:blank:]]*key[[:blank:]]\+=[[:blank:]]\(.*\)/\1/p' ${KEYRING} | base64 -w0) - cat > ${SECRET} < "${SECRET}" <