From 21627f5b7edd479f53e3ba4ad71ecc7939b6f1b2 Mon Sep 17 00:00:00 2001 From: Elson O Rodriguez Date: Wed, 13 Apr 2016 12:30:29 -0700 Subject: [PATCH] Made it so that existing Openstack environment variables are used. If someone has an openrc as part of their profile, this will make kube-up work automatically. The only things that have to be modified are in config-default.sh, either by editing the file or setting environment variables. --- cluster/openstack/openrc-default.sh | 13 +++++++------ cluster/openstack/openrc-swift.sh | 16 ++++++++-------- cluster/openstack/util.sh | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/cluster/openstack/openrc-default.sh b/cluster/openstack/openrc-default.sh index 6e9fe67f237..9071e258f25 100644 --- a/cluster/openstack/openrc-default.sh +++ b/cluster/openstack/openrc-default.sh @@ -15,10 +15,11 @@ # limitations under the License. ## Enviroment variables for the OpenStack command-line client +## Values set via an openrc will override these defaults. -export OS_IDENTITY_API_VERSION=2.0 -export OS_USERNAME=admin -export OS_PASSWORD=secretsecret -export OS_AUTH_URL=http://192.168.123.100:5000/v2.0 -export OS_TENANT_NAME=admin -export OS_TENANT_ID=ed51b98b40944d89a449592eb67431eb +export OS_IDENTITY_API_VERSION=${OS_IDENTITY_API_VERSION:-2.0} +export OS_USERNAME=${OS_USERNAME:-admin} +export OS_PASSWORD=${OS_PASSWORD:-secretsecret} +export OS_AUTH_URL=${OS_AUTH_URL:-http://192.168.123.100:5000/v2.0} +export OS_TENANT_NAME=${OS_TENANT_NAME:-admin} +export OS_TENANT_ID=${OS_TENANT_ID:-ed51b98b40944d89a449592eb67431eb} diff --git a/cluster/openstack/openrc-swift.sh b/cluster/openstack/openrc-swift.sh index e8e69504df0..daad5704347 100644 --- a/cluster/openstack/openrc-swift.sh +++ b/cluster/openstack/openrc-swift.sh @@ -15,12 +15,12 @@ # limitations under the License. ## Enviroment variables for the OpenStack Swift command-line client. This is required for CityCloud -## provider where Swift has different credentials. When Swift is part of your OpenStack use the same -## settings as in openrc-default.sh +## provider where Swift has different credentials. When Swift is part of your OpenStack do not +## modify these settings. -export OS_IDENTITY_API_VERSION=2.0 -export OS_USERNAME=admin -export OS_PASSWORD=secretsecret -export OS_AUTH_URL=http://192.168.123.100:5000/v2.0 -export OS_TENANT_NAME=admin -export OS_TENANT_ID=ed51b98b40944d89a449592eb67431eb +export OS_IDENTITY_API_VERSION=${OS_IDENTITY_API_VERSION:-2.0} +export OS_USERNAME=${OS_USERNAME:-admin} +export OS_PASSWORD=${OS_PASSWORD:-secretsecret} +export OS_AUTH_URL=${OS_AUTH_URL:-http://192.168.123.100:5000/v2.0} +export OS_TENANT_NAME=${OS_TENANT_NAME:-admin} +export OS_TENANT_ID=${OS_TENANT_ID:-ed51b98b40944d89a449592eb67431eb} diff --git a/cluster/openstack/util.sh b/cluster/openstack/util.sh index a93048e1789..b1a102cff0c 100644 --- a/cluster/openstack/util.sh +++ b/cluster/openstack/util.sh @@ -91,7 +91,7 @@ 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}" ]]; then + if [[ -z ${OS_PROJECT_ID+x} ]]; then SWIFT_PROJECT_ID="${OS_TENANT_ID}" else SWIFT_PROJECT_ID="${OS_PROJECT_ID}"