소스 검색

Set the master cluster hostname under OpenStack

Depending on the deployment (with or without a loadbalancer, with or
without external DNS) the `openshift_master_cluster_hostname` may be
different. And given the OpenStack's hostname suffix behaviour, it is
almost never set to the right value on its own.

This updates the Heat templates and the dynamic inventory to set the
variable to a value that should always work and it can always be
overridden in the group_vars .
Tomas Sedovic 7 년 전
부모
커밋
b6587d0466
2개의 변경된 파일19개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      playbooks/openstack/inventory.py
  2. 12 0
      roles/openshift_openstack/templates/heat_stack.yaml.j2

+ 7 - 1
playbooks/openstack/inventory.py

@@ -51,7 +51,7 @@ def base_openshift_inventory(cluster_hosts):
     osev3 = list(set(nodes + etcd + load_balancers))
     osev3 = list(set(nodes + etcd + load_balancers))
 
 
     inventory['cluster_hosts'] = {'hosts': [s.name for s in cluster_hosts]}
     inventory['cluster_hosts'] = {'hosts': [s.name for s in cluster_hosts]}
-    inventory['OSEv3'] = {'hosts': osev3}
+    inventory['OSEv3'] = {'hosts': osev3, 'vars': {}}
     inventory['masters'] = {'hosts': masters}
     inventory['masters'] = {'hosts': masters}
     inventory['etcd'] = {'hosts': etcd}
     inventory['etcd'] = {'hosts': etcd}
     inventory['nodes'] = {'hosts': nodes}
     inventory['nodes'] = {'hosts': nodes}
@@ -168,6 +168,12 @@ def build_inventory():
         except KeyError:
         except KeyError:
             pass  # Not an API load balanced deployment
             pass  # Not an API load balanced deployment
 
 
+        try:
+            inventory['OSEv3']['vars'][
+                'openshift_master_cluster_hostname'] = stout['private_api_ip']
+        except KeyError:
+            pass  # Internal LB not specified
+
         inventory['localhost']['openshift_openstack_public_api_ip'] = \
         inventory['localhost']['openshift_openstack_public_api_ip'] = \
             stout.get('public_api_ip')
             stout.get('public_api_ip')
         inventory['localhost']['openshift_openstack_public_router_ip'] = \
         inventory['localhost']['openshift_openstack_public_router_ip'] = \

+ 12 - 0
roles/openshift_openstack/templates/heat_stack.yaml.j2

@@ -76,6 +76,18 @@ outputs:
     value: { get_attr: [infra_nodes, resource.0, floating_ip] }
     value: { get_attr: [infra_nodes, resource.0, floating_ip] }
 {% endif %}
 {% endif %}
 
 
+  private_api_ip:
+    description: >
+      The address of the private OpenShift API. This is used during OpenShift
+      deployment and for API access by the internal pods and services.
+{% if openshift_openstack_use_lbaas_load_balancer %}
+    value: { get_attr: [api_lb, vip_address] }
+{% elif openshift_openstack_use_vm_load_balancer %}
+    value: { get_attr: [loadbalancer, resource.0, private_ip] }
+{% else %}
+    value: { get_attr: [masters, resource.0, private_ip] }
+{% endif %}
+
 {% if openshift_use_kuryr|default(false)|bool %}
 {% if openshift_use_kuryr|default(false)|bool %}
   vm_subnet:
   vm_subnet:
     description: ID of the subnet the Pods will be on
     description: ID of the subnet the Pods will be on