bc053c09c1
Introduce kolla_address filter. Introduce put_address_in_context filter. Add AF config to vars. Address contexts: - raw (default): <ADDR> - memcache: inet6:[<ADDR>] - url: [<ADDR>] Other changes: globals.yml - mention just IP in comment prechecks/port_checks (api_intf) - kolla_address handles validation 3x interface conditional (swift configs: replication/storage) 2x interface variable definition with hostname (haproxy listens; api intf) 1x interface variable definition with hostname with bifrost exclusion (baremetal pre-install /etc/hosts; api intf) neutron's ml2 'overlay_ip_version' set to 6 for IPv6 on tunnel network basic multinode source CI job for IPv6 prechecks for rabbitmq and qdrouterd use proper NSS database now MariaDB Galera Cluster WSREP SST mariabackup workaround (socat and IPv6) Ceph naming workaround in CI TODO: probably needs documenting RabbitMQ IPv6-only proto_dist Ceph ms switch to IPv6 mode Remove neutron-server ml2_type_vxlan/vxlan_group setting as it is not used (let's avoid any confusion) and could break setups without proper multicast routing if it started working (also IPv4-only) haproxy upgrade checks for slaves based on ipv6 addresses TODO: ovs-dpdk grabs ipv4 network address (w/ prefix len / submask) not supported, invalid by default because neutron_external has no address No idea whether ovs-dpdk works at all atm. ml2 for xenapi Xen is not supported too well. This would require working with XenAPI facts. rp_filter setting This would require meddling with ip6tables (there is no sysctl param). By default nothing is dropped. Unlikely we really need it. ironic dnsmasq is configured IPv4-only dnsmasq needs DHCPv6 options and testing in vivo. KNOWN ISSUES (beyond us): One cannot use IPv6 address to reference the image for docker like we currently do, see: https://github.com/moby/moby/issues/39033 (docker_registry; docker API 400 - invalid reference format) workaround: use hostname/FQDN RabbitMQ may fail to bind to IPv6 if hostname resolves also to IPv4. This is due to old RabbitMQ versions available in images. IPv4 is preferred by default and may fail in the IPv6-only scenario. This should be no problem in real life as IPv6-only is indeed IPv6-only. Also, when new RabbitMQ (3.7.16/3.8+) makes it into images, this will no longer be relevant as we supply all the necessary config. See: https://github.com/rabbitmq/rabbitmq-server/pull/1982 For reliable runs, at least Ansible 2.8 is required (2.8.5 confirmed to work well). Older Ansible versions are known to miss IPv6 addresses in interface facts. This may affect redeploys, reconfigures and upgrades which run after VIP address is assigned. See: https://github.com/ansible/ansible/issues/63227 Bifrost Train does not support IPv6 deployments. See: https://storyboard.openstack.org/#!/story/2006689 Change-Id: Ia34e6916ea4f99e9522cd2ddde03a0a4776f7e2c Implements: blueprint ipv6-control-plane Signed-off-by: Radosław Piliszek <radoslaw.piliszek@gmail.com>
126 lines
5.6 KiB
Django/Jinja
126 lines
5.6 KiB
Django/Jinja
#jinja2: lstrip_blocks: True
|
|
{%- set external_tls_bind_info = 'ssl crt /etc/haproxy/haproxy.pem' if kolla_enable_tls_external|bool else '' %}
|
|
{%- set internal_tls_bind_info = 'ssl crt /etc/haproxy/haproxy-internal.pem' if kolla_enable_tls_internal|bool else '' %}
|
|
|
|
{%- macro userlist_macro(service_name, auth_user, auth_pass) %}
|
|
userlist {{ service_name }}-user
|
|
user {{ auth_user }} insecure-password {{ auth_pass }}
|
|
{% endmacro %}
|
|
|
|
{%- macro frontend_macro(service_name, service_port, service_mode, external,
|
|
frontend_http_extra, frontend_tcp_extra) %}
|
|
frontend {{ service_name }}_front
|
|
{% if service_mode == 'redirect' %}
|
|
mode http
|
|
{% else %}
|
|
mode {{ service_mode }}
|
|
{% endif %}
|
|
{% if service_mode == 'http' %}
|
|
{# Delete any pre-populated XFP header #}
|
|
http-request del-header X-Forwarded-Proto
|
|
{% for http_option in frontend_http_extra %}
|
|
{{ http_option }}
|
|
{% endfor %}
|
|
{% elif service_mode == 'tcp' %}
|
|
{% for tcp_option in frontend_tcp_extra %}
|
|
{{ tcp_option }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% set tls_option = '' %}
|
|
{% if external|bool %}
|
|
{% set vip_address = kolla_external_vip_address %}
|
|
{% if service_mode == 'http' %}
|
|
{% set tls_option = external_tls_bind_info %}
|
|
{# Replace the XFP header for external https requests #}
|
|
http-request set-header X-Forwarded-Proto https if { ssl_fc }
|
|
{% endif %}
|
|
{% else %}
|
|
{% set vip_address = kolla_internal_vip_address %}
|
|
{% if service_mode == 'http' %}
|
|
{% set tls_option = internal_tls_bind_info %}
|
|
{# Replace the XFP header for internal https requests #}
|
|
http-request set-header X-Forwarded-Proto https if { ssl_fc }
|
|
{% endif %}
|
|
{% endif %}
|
|
{{ "bind %s:%s %s"|e|format(vip_address, service_port, tls_option)|trim() }}
|
|
{# Redirect mode sets a redirect scheme instead of a backend #}
|
|
{% if service_mode == 'redirect' %}
|
|
redirect scheme https code 301 if !{ ssl_fc }
|
|
{% else %}
|
|
default_backend {{ service_name }}_back
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{%- macro backend_macro(service_name, listen_port, service_mode, host_group,
|
|
custom_member_list, backend_http_extra,
|
|
backend_tcp_extra, auth_user, auth_pass) %}
|
|
backend {{ service_name }}_back
|
|
{% if service_mode == 'redirect' %}
|
|
mode http
|
|
{% else %}
|
|
mode {{ service_mode }}
|
|
{% endif %}
|
|
{% if service_mode == 'http' %}
|
|
{# Set up auth if required #}
|
|
{% if auth_user and auth_pass %}
|
|
acl auth_acl http_auth({{ service_name }}-user)
|
|
http-request auth realm basicauth unless auth_acl
|
|
{% endif %}
|
|
{% for http_option in backend_http_extra %}
|
|
{{ http_option }}
|
|
{% endfor %}
|
|
{% elif service_mode == 'tcp' %}
|
|
{% for tcp_option in backend_tcp_extra %}
|
|
{{ tcp_option }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% if custom_member_list is not none %}
|
|
{% for custom_member in custom_member_list %}
|
|
{{ custom_member }}
|
|
{% endfor %}
|
|
{% else %}
|
|
{% for host in groups[host_group] %}
|
|
{% set host_name = hostvars[host]['ansible_hostname'] %}
|
|
{% set host_ip = 'api' | kolla_address(host) %}
|
|
server {{ host_name }} {{ host_ip }}:{{ listen_port }} {{ haproxy_health_check }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{%- set haproxy = service.haproxy|default({}) %}
|
|
{%- for haproxy_name, haproxy_service in haproxy.items() %}
|
|
{# External defaults to false #}
|
|
{% set external = haproxy_service.external|default(false)|bool %}
|
|
{# Skip anything that is external when the external vip is not enabled #}
|
|
{% if haproxy_service.enabled|bool and (not external or haproxy_enable_external_vip|bool)%}
|
|
{# Here we define variables and their defaults #}
|
|
{# services can be listening on a different port than haproxy #}
|
|
{% set listen_port = haproxy_service.listen_port|default(haproxy_service.port) %}
|
|
{# Custom member list can use jinja to generate a semicolon separated list #}
|
|
{% set custom_member_list = haproxy_service.custom_member_list|default() %}
|
|
{# Mode defaults to http #}
|
|
{% set mode = haproxy_service.mode|default('http') %}
|
|
{# Use the parent host group but allow it to be overridden #}
|
|
{% set host_group = haproxy_service.host_group|default(service.group) %}
|
|
{# Additional options can be defined in config, and are additive to the global extras #}
|
|
{% set frontend_tcp_extra = haproxy_service.frontend_tcp_extra|default([]) + haproxy_frontend_tcp_extra %}
|
|
{% set backend_tcp_extra = haproxy_service.backend_tcp_extra|default([]) %}
|
|
{% set frontend_http_extra = haproxy_service.frontend_http_extra|default([]) + haproxy_frontend_http_extra %}
|
|
{% set backend_http_extra = haproxy_service.backend_http_extra|default([]) %}
|
|
{# Allow for basic auth #}
|
|
{% set auth_user = haproxy_service.auth_user|default() %}
|
|
{% set auth_pass = haproxy_service.auth_pass|default() %}
|
|
{% if auth_user and auth_pass %}
|
|
{{ userlist_macro(haproxy_name, auth_user, auth_pass) }}
|
|
{% endif %}
|
|
{{ frontend_macro(haproxy_name, haproxy_service.port, mode, external,
|
|
frontend_http_extra, frontend_tcp_extra) }}
|
|
{# Redirect (to https) is a special case, as it does not include a backend #}
|
|
{% if haproxy_service.mode != 'redirect' %}
|
|
{{ backend_macro(haproxy_name, listen_port, mode, host_group,
|
|
custom_member_list, backend_http_extra, backend_tcp_extra,
|
|
auth_user, auth_pass) }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{%- endfor -%}
|