From 6b80ac65006f378cebbcaeca0e72df01c475c44d Mon Sep 17 00:00:00 2001 From: Simon Li Date: Fri, 9 Feb 2018 22:41:31 +0000 Subject: [PATCH] Fix indexing of supplementary DNS in openssl.conf --- roles/kubernetes/secrets/templates/openssl.conf.j2 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/kubernetes/secrets/templates/openssl.conf.j2 b/roles/kubernetes/secrets/templates/openssl.conf.j2 index a214739c9..adc875ba6 100644 --- a/roles/kubernetes/secrets/templates/openssl.conf.j2 +++ b/roles/kubernetes/secrets/templates/openssl.conf.j2 @@ -15,9 +15,10 @@ DNS.5 = localhost {% for host in groups['kube-master'] %} DNS.{{ 5 + loop.index }} = {{ host }} {% endfor %} +{% set idns = groups['kube-master'] | length | int + 5 %} {% if loadbalancer_apiserver is defined %} -{% set idx = groups['kube-master'] | length | int + 5 + 1 %} -DNS.{{ idx | string }} = {{ apiserver_loadbalancer_domain_name }} +{% set idns = idns + 1 %} +DNS.{{ idns | string }} = {{ apiserver_loadbalancer_domain_name }} {% endif %} {% for host in groups['kube-master'] %} IP.{{ 2 * loop.index - 1 }} = {{ hostvars[host]['access_ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }} @@ -36,7 +37,7 @@ IP.{{ idx + 1 }} = 127.0.0.1 {% if addr | ipaddr %} IP.{{ is + loop.index }} = {{ addr }} {% else %} -DNS.{{ is + loop.index }} = {{ addr }} +DNS.{{ idns + loop.index }} = {{ addr }} {% endif %} {% endfor %} {% endif %}