You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.2 KiB

  1. [req]
  2. req_extensions = v3_req
  3. distinguished_name = req_distinguished_name
  4. [req_distinguished_name]
  5. [ v3_req ]
  6. basicConstraints = CA:FALSE
  7. keyUsage = nonRepudiation, digitalSignature, keyEncipherment
  8. subjectAltName = @alt_names
  9. [alt_names]
  10. DNS.1 = kubernetes
  11. DNS.2 = kubernetes.default
  12. DNS.3 = kubernetes.default.svc
  13. DNS.4 = kubernetes.default.svc.{{ dns_domain }}
  14. DNS.5 = localhost
  15. {% for host in groups['kube-master'] %}
  16. DNS.{{ 5 + loop.index }} = {{ host }}
  17. {% endfor %}
  18. {% if loadbalancer_apiserver is defined %}
  19. {% set idx = groups['kube-master'] | length | int + 5 + 1 %}
  20. DNS.{{ idx | string }} = {{ apiserver_loadbalancer_domain_name }}
  21. {% endif %}
  22. {% for host in groups['kube-master'] %}
  23. IP.{{ 2 * loop.index - 1 }} = {{ hostvars[host]['access_ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}
  24. IP.{{ 2 * loop.index }} = {{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }}
  25. {% endfor %}
  26. {% set idx = groups['kube-master'] | length | int * 2 + 1 %}
  27. IP.{{ idx }} = {{ kube_apiserver_ip }}
  28. IP.{{ idx + 1 }} = 127.0.0.1
  29. {% if supplementary_addresses_in_ssl_keys is defined %}
  30. {% set is = idx + 1 %}
  31. {% for addr in supplementary_addresses_in_ssl_keys %}
  32. IP.{{ is + loop.index }} = {{ addr }}
  33. {% endfor %}
  34. {% endif %}