Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kubespray
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Kubespray
Commits
0df32b03
Commit
0df32b03
authored
7 years ago
by
woopstar
Committed by
Andreas Kruger
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update openssl.conf to count better and work with Jinja 2.9
parent
03117d95
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
roles/etcd/templates/openssl.conf.j2
+10
-11
10 additions, 11 deletions
roles/etcd/templates/openssl.conf.j2
roles/kubernetes/secrets/templates/openssl.conf.j2
+25
-17
25 additions, 17 deletions
roles/kubernetes/secrets/templates/openssl.conf.j2
with
35 additions
and
28 deletions
roles/etcd/templates/openssl.conf.j2
+
10
−
11
View file @
0df32b03
[req]
{% set counter = {'dns': 2,'ip': 1,} %}{% macro increment(dct, key, inc=1)%}{% if dct.update({key: dct[key] + inc}) %} {% endif %}{% endmacro %}
[req]
req_extensions = v3_req
distinguished_name = req_distinguished_name
...
...
@@ -25,19 +25,18 @@ authorityKeyIdentifier=keyid:always,issuer
[alt_names]
DNS.1 = localhost
{% for host in groups['etcd'] %}
DNS.{{
1 + loop.index
}} = {{ host }}
DNS.{{
counter["dns"]
}} = {{ host }}
{{ increment(counter, 'dns') }}
{% endfor %}
{% if loadbalancer_apiserver is defined %}
{% set idx = groups['etcd'] | length | int + 2 %}
DNS.{{ idx | string }} = {{ apiserver_loadbalancer_domain_name }}
{% if apiserver_loadbalancer_domain_name is defined %}
DNS.{{ counter["dns"] }} = {{ apiserver_loadbalancer_domain_name }}{{ increment(counter, 'dns') }}
{% endif %}
{% set idx = groups['etcd'] | length | int + 3 %}
{% for etcd_alt_name in etcd_cert_alt_names %}
DNS.{{
idx + 1 + loop.index
}} = {{ etcd_alt_name }}
DNS.{{
counter["dns"]
}} = {{ etcd_alt_name }}
{{ increment(counter, 'dns') }}
{% endfor %}
{% for host in groups['etcd'] %}
IP.{{ 2 * loop.index - 1 }} = {{ hostvars[host]['access_ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}
IP.{{ 2 * loop.index }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}
{% if hostvars[host]['access_ip'] is defined %}
IP.{{ counter["ip"] }} = {{ hostvars[host]['access_ip'] }}{{ increment(counter, 'ip') }}
{% endif %}
IP.{{ counter["ip"] }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}{{ increment(counter, 'ip') }}
{% endfor %}
{% set idx = groups['etcd'] | length | int * 2 + 1 %}
IP.{{ idx }} = 127.0.0.1
IP.{{ counter["ip"] }} = 127.0.0.1
This diff is collapsed.
Click to expand it.
roles/kubernetes/secrets/templates/openssl.conf.j2
+
25
−
17
View file @
0df32b03
[req]
{% set counter = {'dns': 6,'ip': 1,} %}{% macro increment(dct, key, inc=1)%}{% if dct.update({key: dct[key] + inc}) %} {% endif %}{% endmacro %}
[req]
req_extensions = v3_req
distinguished_name = req_distinguished_name
[req_distinguished_name]
...
...
@@ -13,31 +13,39 @@ DNS.3 = kubernetes.default.svc
DNS.4 = kubernetes.default.svc.{{ dns_domain }}
DNS.5 = localhost
{% for host in groups['kube-master'] %}
DNS.{{
5 + loop.index
}} = {{ host }}
DNS.{{
counter["dns"]
}} = {{ host }}
{{ increment(counter, 'dns') }}
{% endfor %}
{% set idns = groups['kube-master'] | length | int + 5 %}
{% if loadbalancer_apiserver is defined %}
{% set idns = idns + 1 %}
DNS.{{ idns | string }} = {{ apiserver_loadbalancer_domain_name }}
{% for host in groups['kube-node'] %}
DNS.{{ counter["dns"] }} = {{ host }}{{ increment(counter, 'dns') }}
{% endfor %}
{% if apiserver_loadbalancer_domain_name is defined %}
DNS.{{ counter["dns"] }} = {{ apiserver_loadbalancer_domain_name }}{{ increment(counter, 'dns') }}
{% endif %}
{% for host in groups['kube-master'] %}
IP.{{ 2 * loop.index - 1 }} = {{ hostvars[host]['access_ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}
IP.{{ 2 * loop.index }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}
{% if hostvars[host]['access_ip'] is defined %}
IP.{{ counter["ip"] }} = {{ hostvars[host]['access_ip'] }}{{ increment(counter, 'ip') }}
{% endif %}
IP.{{ counter["ip"] }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}{{ increment(counter, 'ip') }}
{% endfor %}
{% set idx = groups['kube-master'] | length | int * 2 + 1 %}
IP.{{ idx }} = {{ kube_apiserver_ip }}
{% if loadbalancer_apiserver is defined %}
IP.{{ idx + 1 }} = {{ loadbalancer_apiserver.address }}
{% set idx = idx + 1 %}
{% for host in groups['kube-node'] %}
{% if hostvars[host]['access_ip'] is defined %}
IP.{{ counter["ip"] }} = {{ hostvars[host]['access_ip'] }}{{ increment(counter, 'ip') }}
{% endif %}
IP.{{ counter["ip"] }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}{{ increment(counter, 'ip') }}
{% endfor %}
{% if kube_apiserver_ip is defined %}
IP.{{ counter["ip"] }} = {{ kube_apiserver_ip }}{{ increment(counter, 'ip') }}
{% endif %}
{% if loadbalancer_apiserver.address is defined %}
IP.{{ counter["ip"] }} = {{ loadbalancer_apiserver.address }}{{ increment(counter, 'ip') }}
{% endif %}
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 %}
{% if addr | ipaddr %}
IP.{{
is + loop.index
}} = {{ addr }}
IP.{{
counter["ip"]
}} = {{ addr }}
{{ increment(counter, 'ip') }}
{% else %}
DNS.{{
idns + loop.index }} = {{ addr
}}
DNS.{{
counter["dns"] }} = {{ addr }}{{ increment(counter, 'dns')
}}
{% endif %}
{% endfor %}
{% endif %}
IP.{{ counter["ip"] }} = 127.0.0.1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment