diff --git a/cluster/openstack-heat/config-default.sh b/cluster/openstack-heat/config-default.sh index 480e6f43059..6c4947f86c8 100644 --- a/cluster/openstack-heat/config-default.sh +++ b/cluster/openstack-heat/config-default.sh @@ -35,8 +35,7 @@ MINION_FLAVOR=${MINION_FLAVOR:-m1.medium} EXTERNAL_NETWORK=${EXTERNAL_NETWORK:-public} -#FIXME This can get set by evaulating the output of `swift auth` and stripping the base URL from OS_STORAGE_URL, but will require a refactor. Till then... -SWIFT_SERVER_URL=${SWIFT_SERVER_URL:-http://192.168.123.100:8080} +SWIFT_SERVER_URL=${SWIFT_SERVER_URL:-} # Flag indicates if new image must be created. If 'false' then image with IMAGE_ID will be used. # If 'true' then new image will be created from file config-image.sh diff --git a/cluster/openstack-heat/util.sh b/cluster/openstack-heat/util.sh index 80a0e70376b..2b64a19fef7 100644 --- a/cluster/openstack-heat/util.sh +++ b/cluster/openstack-heat/util.sh @@ -91,11 +91,6 @@ function create-stack() { echo "[INFO] Execute commands to create Kubernetes cluster" # It is required for some cloud provider like CityCloud where swift client has different credentials source "${ROOT}/openrc-swift.sh" - if [[ -z ${OS_PROJECT_ID+x} ]]; then - SWIFT_PROJECT_ID="${OS_TENANT_ID}" - else - SWIFT_PROJECT_ID="${OS_PROJECT_ID}" - fi upload-resources source "${ROOT}/openrc-default.sh" @@ -168,7 +163,6 @@ function create-glance-image() { # KUBERNETES_KEYPAIR_NAME # DNS_SERVER # SWIFT_SERVER_URL -# SWIFT_TENANT_ID # OPENSTACK_IMAGE_NAME # EXTERNAL_NETWORK # IMAGE_ID @@ -181,7 +175,12 @@ function create-glance-image() { function run-heat-script() { local stack_status=$(openstack stack show ${STACK_NAME}) - local swift_repo_url="${SWIFT_SERVER_URL}/v1/AUTH_${SWIFT_PROJECT_ID}/kubernetes" + + # Automatically detect swift url if it wasn't specified + if [[ -z $SWIFT_SERVER_URL ]]; then + SWIFT_SERVER_URL=$(openstack catalog show object-store --format value | egrep -o "publicURL: (.+)$" | cut -d" " -f2) + fi + local swift_repo_url="${SWIFT_SERVER_URL}/kubernetes" if [ $CREATE_IMAGE = true ]; then echo "[INFO] Retrieve new image ID"