Automatically detect swift URL if not specified

pull/6/head
Francois Deppierraz 2016-05-05 23:45:58 +02:00
parent 53eef9e412
commit 1769760db0
2 changed files with 7 additions and 9 deletions

View File

@ -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

View File

@ -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"