summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Sedovic <tomas@sedovic.cz>2018-01-04 16:15:44 +0100
committerTomas Sedovic <tomas@sedovic.cz>2018-01-10 13:47:52 +0100
commitc35c8f3e8369eb3d2ab7675c30e8d258eccd6a18 (patch)
treec74864df36a92f4121b7e7c10b1050924c8e7d90
parentde44771f97d506f0dbbbcff90938fc566e8a9ac1 (diff)
downloadopenshift-c35c8f3e8369eb3d2ab7675c30e8d258eccd6a18.tar.gz
openshift-c35c8f3e8369eb3d2ab7675c30e8d258eccd6a18.tar.bz2
openshift-c35c8f3e8369eb3d2ab7675c30e8d258eccd6a18.tar.xz
openshift-c35c8f3e8369eb3d2ab7675c30e8d258eccd6a18.zip
Allow using server names in openstack dynamic inv
When deploying on OpenStack with internal DNS configured, this will set `openshift_hostname` to the Nova server name instead of its IP address. Without those two matching, the OpenStack cloud provider configuration will fail and the OpenShift nodes will not start.
-rwxr-xr-xplaybooks/openstack/sample-inventory/inventory.py6
-rw-r--r--roles/openshift_openstack/templates/heat_stack_server.yaml.j23
2 files changed, 7 insertions, 2 deletions
diff --git a/playbooks/openstack/sample-inventory/inventory.py b/playbooks/openstack/sample-inventory/inventory.py
index 45cc4e15a..76e658eb7 100755
--- a/playbooks/openstack/sample-inventory/inventory.py
+++ b/playbooks/openstack/sample-inventory/inventory.py
@@ -89,13 +89,15 @@ def build_inventory():
# TODO(shadower): what about multiple networks?
if server.private_v4:
hostvars['private_v4'] = server.private_v4
+ hostvars['openshift_ip'] = server.private_v4
+
# NOTE(shadower): Yes, we set both hostname and IP to the private
# IP address for each node. OpenStack doesn't resolve nodes by
# name at all, so using a hostname here would require an internal
# DNS which would complicate the setup and potentially introduce
# performance issues.
- hostvars['openshift_ip'] = server.private_v4
- hostvars['openshift_hostname'] = server.private_v4
+ hostvars['openshift_hostname'] = server.metadata.get(
+ 'openshift_hostname', server.private_v4)
hostvars['openshift_public_hostname'] = server.name
if server.metadata['host-type'] == 'cns':
diff --git a/roles/openshift_openstack/templates/heat_stack_server.yaml.j2 b/roles/openshift_openstack/templates/heat_stack_server.yaml.j2
index a829da34f..1e73c9e1c 100644
--- a/roles/openshift_openstack/templates/heat_stack_server.yaml.j2
+++ b/roles/openshift_openstack/templates/heat_stack_server.yaml.j2
@@ -212,6 +212,9 @@ resources:
host-type: { get_param: type }
sub-host-type: { get_param: subtype }
node_labels: { get_param: node_labels }
+{% if openshift_openstack_dns_nameservers %}
+ openshift_hostname: { get_param: name }
+{% endif %}
scheduler_hints: { get_param: scheduler_hints }
{% if use_trunk_ports|default(false)|bool %}