Add possibility to insert more ip adresses in certificates (#1678)

* Add possibility to insert more ip adresses in certificates

* Add newline at end of files

* Move supp ip parameters to k8s-cluster group file

* Add supplementary addresses in kubeadm master role

* Improve openssl indexes
pull/1818/merge
Rémi de Passmoilesel 2017-10-17 12:06:07 +02:00 committed by Matthew Mosesohn
parent 688e589e0c
commit 356515222a
3 changed files with 16 additions and 2 deletions

View File

@ -170,3 +170,7 @@ istio_enabled: false
# A comma separated list of levels of node allocatable enforcement to be enforced by kubelet.
# Acceptible options are 'pods', 'system-reserved', 'kube-reserved' and ''. Default is "".
# kubelet_enforce_node_allocatable: pods
## Supplementary addresses that can be added in kubernetes ssl keys.
## That can be usefull for example to setup a keepalived virtual IP
# supplementary_addresses_in_ssl_keys: [10.0.0.1, 10.0.0.2, 10.0.0.3]

View File

@ -54,8 +54,12 @@
{%- if hostvars[host]['access_ip'] is defined %}{{ hostvars[host]['access_ip'] }}{% endif %}
{{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}
{%- endfor %}
tags:
- facts
{% if supplementary_addresses_in_ssl_keys is defined %}
{% for addr in supplementary_addresses_in_ssl_keys %}
{{ addr }}
{% endfor %}
{% endif %}
tags: facts
- name: kubeadm | Copy etcd cert dir under k8s cert dir
command: "cp -TR {{ etcd_cert_dir }} {{ kube_config_dir }}/ssl/etcd"

View File

@ -26,3 +26,9 @@ IP.{{ 2 * loop.index }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansi
{% set idx = groups['kube-master'] | length | int * 2 + 1 %}
IP.{{ idx }} = {{ kube_apiserver_ip }}
IP.{{ idx + 1 }} = 127.0.0.1
{% if supplementary_addresses_in_ssl_keys is defined %}
{% set is = idx + 1 %}
{% for addr in supplementary_addresses_in_ssl_keys %}
IP.{{ is + loop.index }} = {{ addr }}
{% endfor %}
{% endif %}