Skip to content

Commit

Permalink
Fix etcd certificate to acces address as SAN
Browse files Browse the repository at this point in the history
  • Loading branch information
derselbst committed Jul 18, 2024
1 parent 5f35b66 commit 02c7e8b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions roles/etcd/templates/openssl.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ authorityKeyIdentifier=keyid:always,issuer
[alt_names]
DNS.1 = localhost
{% for host in groups['etcd'] %}
{% if hostvars[host]['etcd_access_address'] is defined and not (hostvars[host]['etcd_access_address'] | ansible.utils.ipaddr) %}
{# If defined, the address which etcd uses to access its members must be included in the SAN, otherwise etcd will fail with a TLS error upon startup. #}
DNS.{{ counter["dns"] }} = {{ hostvars[host]['etcd_access_address'] }}{{ increment(counter, 'dns') }}
{% endif %}
{# This will always expand to inventory_hostname, which can be a completely arbitrary name, that etcd will not know or care about, hence this line is (probably) redundant. #}
DNS.{{ counter["dns"] }} = {{ host }}{{ increment(counter, 'dns') }}
{% endfor %}
{% if apiserver_loadbalancer_domain_name is defined %}
Expand Down

0 comments on commit 02c7e8b

Please sign in to comment.