Browse Source

manage undefined vars for loadbalancing

pull/22/head
Smaine Kahlouch 9 years ago
parent
commit
c91a3183d3
3 changed files with 4 additions and 2 deletions
  1. 2
      roles/dnsmasq/tasks/main.yml
  2. 2
      roles/kubernetes/node/templates/manifests/kube-proxy.manifest.j2
  3. 2
      roles/kubernetes/node/templates/openssl.conf.j2

2
roles/dnsmasq/tasks/main.yml

@ -14,7 +14,7 @@
regexp: ".*{{ apiserver_loadbalancer_domain_name }}$"
line: "{{ loadbalancer_apiserver.address }} lb-apiserver.kubernetes.local"
state: present
when: loadbalancer_apiserver is defined
when: loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined
- name: clean hosts file
lineinfile:

2
roles/kubernetes/node/templates/manifests/kube-proxy.manifest.j2

@ -15,7 +15,7 @@ spec:
{% if inventory_hostname in groups['kube-master'] %}
- --master=http://127.0.0.1:8080
{% else %}
{% if loadbalancer_apiserver.address is defined | default('') %}
{% if loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined %}
- --master=https://{{ apiserver_loadbalancer_domain_name }}:{{ loadbalancer_apiserver.port }}
{% else %}
- --master=https://{{ groups['kube-master'][0] }}:{{ kube_apiserver_port }}

2
roles/kubernetes/node/templates/openssl.conf.j2

@ -10,7 +10,9 @@ subjectAltName = @alt_names
DNS.1 = kubernetes
DNS.2 = kubernetes.default
DNS.3 = kubernetes.default.svc.{{ dns_domain }}
{% if loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined %}
DNS.4 = {{ apiserver_loadbalancer_domain_name }}
{% endif %}
{% for host in groups['kube-master'] %}
IP.{{ loop.index }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}
{% endfor %}

Loading…
Cancel
Save