From d0fc1ec27882d593f25a68eb42244a0b76541198 Mon Sep 17 00:00:00 2001 From: Jim Rollenhagen Date: Thu, 27 Dec 2018 15:37:49 -0500 Subject: [PATCH] Allow heat services to use independent hostnames This allows heat service endpoints to use custom hostnames, and adds the following variables: * heat_internal_fqdn * heat_external_fqdn * heat_cfn_internal_fqdn * heat_cfn_external_fqdn These default to the old values of kolla_internal_fqdn or kolla_external_fqdn. This also adds heat_api_listen_port and heat_api_cfn_listen_port options, which default to heat_api_port and heat_api_cfn_port for backward compatibility. These options allow the user to differentiate between the port the service listens on, and the port the service is reachable on. This is useful for external load balancers which live on the same host as the service itself. Change-Id: Ifb8bb55799703883d81be6a55641be7b2474fd4e Implements: blueprint service-hostnames --- ansible/group_vars/all.yml | 6 ++++++ ansible/roles/heat/defaults/main.yml | 16 ++++++++++------ ansible/roles/heat/tasks/precheck.yml | 4 ++-- ansible/roles/heat/templates/heat.conf.j2 | 10 +++++----- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index f2a59e3ee9..bc3fa85665 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -233,8 +233,14 @@ grafana_server_port: "3000" haproxy_stats_port: "1984" haproxy_monitor_port: "61313" +heat_internal_fqdn: "{{ kolla_internal_fqdn }}" +heat_external_fqdn: "{{ kolla_external_fqdn }}" heat_api_port: "8004" +heat_api_listen_port: "{{ heat_api_port }}" +heat_cfn_internal_fqdn: "{{ kolla_internal_fqdn }}" +heat_cfn_external_fqdn: "{{ kolla_external_fqdn }}" heat_api_cfn_port: "8000" +heat_api_cfn_listen_port: "{{ heat_api_cfn_port }}" horizon_port: "80" diff --git a/ansible/roles/heat/defaults/main.yml b/ansible/roles/heat/defaults/main.yml index 078adf2beb..7bb7669a76 100644 --- a/ansible/roles/heat/defaults/main.yml +++ b/ansible/roles/heat/defaults/main.yml @@ -19,11 +19,13 @@ heat_services: mode: "http" external: false port: "{{ heat_api_port }}" + listen_port: "{{ heat_api_listen_port }}" heat_api_external: enabled: "{{ enable_heat }}" mode: "http" external: true port: "{{ heat_api_port }}" + listen_port: "{{ heat_api_listen_port }}" heat-api-cfn: container_name: heat_api_cfn group: heat-api-cfn @@ -41,11 +43,13 @@ heat_services: mode: "http" external: false port: "{{ heat_api_cfn_port }}" + listen_port: "{{ heat_api_cfn_listen_port }}" heat_api_cfn_external: enabled: "{{ enable_heat }}" mode: "http" external: true port: "{{ heat_api_cfn_port }}" + listen_port: "{{ heat_api_cfn_listen_port }}" heat-engine: container_name: heat_engine group: heat-engine @@ -92,12 +96,12 @@ heat_engine_dimensions: "{{ default_container_dimensions }}" #################### # OpenStack #################### -heat_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ heat_api_port }}/v1/%(tenant_id)s" -heat_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ heat_api_port }}/v1/%(tenant_id)s" -heat_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ heat_api_port }}/v1/%(tenant_id)s" -heat_cfn_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ heat_api_cfn_port }}/v1" -heat_cfn_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ heat_api_cfn_port }}/v1" -heat_cfn_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ heat_api_cfn_port }}/v1" +heat_admin_endpoint: "{{ admin_protocol }}://{{ heat_internal_fqdn }}:{{ heat_api_port }}/v1/%(tenant_id)s" +heat_internal_endpoint: "{{ internal_protocol }}://{{ heat_internal_fqdn }}:{{ heat_api_port }}/v1/%(tenant_id)s" +heat_public_endpoint: "{{ public_protocol }}://{{ heat_external_fqdn }}:{{ heat_api_port }}/v1/%(tenant_id)s" +heat_cfn_admin_endpoint: "{{ admin_protocol }}://{{ heat_cfn_internal_fqdn }}:{{ heat_api_cfn_port }}/v1" +heat_cfn_internal_endpoint: "{{ internal_protocol }}://{{ heat_cfn_internal_fqdn }}:{{ heat_api_cfn_port }}/v1" +heat_cfn_public_endpoint: "{{ public_protocol }}://{{ heat_cfn_external_fqdn }}:{{ heat_api_cfn_port }}/v1" heat_logging_debug: "{{ openstack_logging_debug }}" diff --git a/ansible/roles/heat/tasks/precheck.yml b/ansible/roles/heat/tasks/precheck.yml index 6c29daaa0e..4454fbd612 100644 --- a/ansible/roles/heat/tasks/precheck.yml +++ b/ansible/roles/heat/tasks/precheck.yml @@ -9,7 +9,7 @@ - name: Checking free port for Heat API wait_for: host: "{{ api_interface_address }}" - port: "{{ heat_api_port }}" + port: "{{ heat_api_listen_port }}" connect_timeout: 1 timeout: 1 state: stopped @@ -20,7 +20,7 @@ - name: Checking free port for Heat API CFN wait_for: host: "{{ api_interface_address }}" - port: "{{ heat_api_cfn_port }}" + port: "{{ heat_api_cfn_listen_port }}" connect_timeout: 1 timeout: 1 state: stopped diff --git a/ansible/roles/heat/templates/heat.conf.j2 b/ansible/roles/heat/templates/heat.conf.j2 index b33dacb0bb..8278cf44d3 100644 --- a/ansible/roles/heat/templates/heat.conf.j2 +++ b/ansible/roles/heat/templates/heat.conf.j2 @@ -3,9 +3,9 @@ debug = {{ heat_logging_debug }} log_dir = /var/log/kolla/heat -heat_watch_server_url = {{ public_protocol }}://{{ kolla_external_fqdn }}:{{ heat_api_cfn_port }} -heat_metadata_server_url = {{ public_protocol }}://{{ kolla_external_fqdn }}:{{ heat_api_cfn_port }} -heat_waitcondition_server_url = {{ public_protocol }}://{{ kolla_external_fqdn }}:{{ heat_api_cfn_port }}/v1/waitcondition +heat_watch_server_url = {{ public_protocol }}://{{ heat_cfn_external_fqdn }}:{{ heat_api_cfn_port }} +heat_metadata_server_url = {{ public_protocol }}://{{ heat_cfn_external_fqdn }}:{{ heat_api_cfn_port }} +heat_waitcondition_server_url = {{ public_protocol }}://{{ heat_cfn_external_fqdn }}:{{ heat_api_cfn_port }}/v1/waitcondition heat_stack_user_role = {{ heat_stack_user_role }} @@ -26,14 +26,14 @@ region_name_for_services = {{ openstack_region_name }} {% if service_name == 'heat-api' %} [heat_api] bind_host = {{ api_interface_address }} -bind_port = {{ heat_api_port }} +bind_port = {{ heat_api_listen_port }} workers = {{ openstack_service_workers }} {% endif %} {% if service_name == 'heat-api-cfn' %} [heat_api_cfn] bind_host = {{ api_interface_address }} -bind_port = {{ heat_api_cfn_port }} +bind_port = {{ heat_api_cfn_listen_port }} workers = {{ openstack_service_workers }} {% endif %}