summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLénaïc Huard <lhuard@amadeus.com>2016-09-29 10:30:23 +0200
committerLénaïc Huard <lhuard@amadeus.com>2016-09-29 10:30:23 +0200
commit4d90cd08d850b5916c93adecbea5b4dcbb22c140 (patch)
tree5f532e018b38b6dbc6473aae38eaea8e48fcbce8
parent7f1a3f99fc39265e39054e5de1a8d6e29f0d63b8 (diff)
downloadopenshift-4d90cd08d850b5916c93adecbea5b4dcbb22c140.tar.gz
openshift-4d90cd08d850b5916c93adecbea5b4dcbb22c140.tar.bz2
openshift-4d90cd08d850b5916c93adecbea5b4dcbb22c140.tar.xz
openshift-4d90cd08d850b5916c93adecbea5b4dcbb22c140.zip
Set the DomainName or DomainID in the OpenStack cloud provider
Whereas with the OpenStack keystone v2 authentication API, the username and the password are enough, the keystone v3 API requires an additional domain parameter. Fixes #2515
-rwxr-xr-xbin/cluster13
-rw-r--r--inventory/byo/hosts.origin.example2
-rw-r--r--inventory/byo/hosts.ose.example2
-rw-r--r--roles/openshift_cloud_provider/templates/openstack.conf.j25
4 files changed, 19 insertions, 3 deletions
diff --git a/bin/cluster b/bin/cluster
index 92174954f..68d2a7cd4 100755
--- a/bin/cluster
+++ b/bin/cluster
@@ -73,9 +73,16 @@ class Cluster(object):
cluster['openshift_cloudprovider_openstack_auth_url'] = os.getenv('OS_AUTH_URL')
cluster['openshift_cloudprovider_openstack_username'] = os.getenv('OS_USERNAME')
cluster['openshift_cloudprovider_openstack_password'] = os.getenv('OS_PASSWORD')
- cluster['openshift_cloudprovider_openstack_tenant_id'] = os.getenv('OS_PROJECT_ID',os.getenv('OS_TENANT_ID'))
- cluster['openshift_cloudprovider_openstack_tenant_name'] = os.getenv('OS_PROJECT_NAME',os.getenv('OS_TENANT_NAME'))
- cluster['openshift_cloudprovider_openstack_region'] = os.getenv('OS_REGION_NAME')
+ if 'OS_USER_DOMAIN_ID' in os.environ:
+ cluster['openshift_cloudprovider_openstack_domain_id'] = os.getenv('OS_USER_DOMAIN_ID')
+ if 'OS_USER_DOMAIN_NAME' in os.environ:
+ cluster['openshift_cloudprovider_openstack_domain_name'] = os.getenv('OS_USER_DOMAIN_NAME')
+ if 'OS_PROJECT_ID' in os.environ or 'OS_TENANT_ID' in os.environ:
+ cluster['openshift_cloudprovider_openstack_tenant_id'] = os.getenv('OS_PROJECT_ID',os.getenv('OS_TENANT_ID'))
+ if 'OS_PROJECT_NAME' is os.environ or 'OS_TENANT_NAME' in os.environ:
+ cluster['openshift_cloudprovider_openstack_tenant_name'] = os.getenv('OS_PROJECT_NAME',os.getenv('OS_TENANT_NAME'))
+ if 'OS_REGION_NAME' in os.environ:
+ cluster['openshift_cloudprovider_openstack_region'] = os.getenv('OS_REGION_NAME')
self.action(args, inventory, cluster, playbook)
diff --git a/inventory/byo/hosts.origin.example b/inventory/byo/hosts.origin.example
index 023f77149..55efc0925 100644
--- a/inventory/byo/hosts.origin.example
+++ b/inventory/byo/hosts.origin.example
@@ -145,6 +145,8 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
#openshift_cloudprovider_openstack_auth_url=http://openstack.example.com:35357/v2.0/
#openshift_cloudprovider_openstack_username=username
#openshift_cloudprovider_openstack_password=password
+#openshift_cloudprovider_openstack_domain_id=domain_id
+#openshift_cloudprovider_openstack_domain_name=domain_name
#openshift_cloudprovider_openstack_tenant_id=tenant_id
#openshift_cloudprovider_openstack_tenant_name=tenant_name
#openshift_cloudprovider_openstack_region=region
diff --git a/inventory/byo/hosts.ose.example b/inventory/byo/hosts.ose.example
index 14dfbd91e..8a5655104 100644
--- a/inventory/byo/hosts.ose.example
+++ b/inventory/byo/hosts.ose.example
@@ -144,6 +144,8 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
#openshift_cloudprovider_openstack_auth_url=http://openstack.example.com:35357/v2.0/
#openshift_cloudprovider_openstack_username=username
#openshift_cloudprovider_openstack_password=password
+#openshift_cloudprovider_openstack_domain_id=domain_id
+#openshift_cloudprovider_openstack_domain_name=domain_name
#openshift_cloudprovider_openstack_tenant_id=tenant_id
#openshift_cloudprovider_openstack_tenant_name=tenant_name
#openshift_cloudprovider_openstack_region=region
diff --git a/roles/openshift_cloud_provider/templates/openstack.conf.j2 b/roles/openshift_cloud_provider/templates/openstack.conf.j2
index ce452db24..313ee02b4 100644
--- a/roles/openshift_cloud_provider/templates/openstack.conf.j2
+++ b/roles/openshift_cloud_provider/templates/openstack.conf.j2
@@ -2,6 +2,11 @@
auth-url = {{ openshift_cloudprovider_openstack_auth_url }}
username = {{ openshift_cloudprovider_openstack_username }}
password = {{ openshift_cloudprovider_openstack_password }}
+{% if openshift_cloudprovider_openstack_domain_id is defined %}
+domain-id = {{ openshift_cloudprovider_openstack_domain_id }}
+{% elif openshift_cloudprovider_openstack_domain_name is defined %}
+domain-name = {{ openshift_cloudprovider_openstack_domain_name }}
+{% endif %}
{% if openshift_cloudprovider_openstack_tenant_id is defined %}
tenant-id = {{ openshift_cloudprovider_openstack_tenant_id }}
{% else %}