fix: add tls sans options for k3s too (#1170)
* fix: add tls sans options for k3s too Signed-off-by: Devin Buhl <devin@buhl.casa> * chore: update comment Signed-off-by: Devin Buhl <devin@buhl.casa> --------- Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
1 parent
295f2e7eac
commit
b41ccc8145
12 files changed
+33
-21
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
|
# Test: k0s
|
||||||
---
|
---
|
||||||
ci_test: true
|
ci_test: true
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ bootstrap_cloudflare_tunnel_secret: fake
|
|||||||
bootstrap_cloudflare_tunnel_id: fake
|
bootstrap_cloudflare_tunnel_id: fake
|
||||||
bootstrap_node_cidr: 10.10.10.0/24
|
bootstrap_node_cidr: 10.10.10.0/24
|
||||||
bootstrap_kube_api_addr: 10.10.10.254
|
bootstrap_kube_api_addr: 10.10.10.254
|
||||||
|
bootstrap_kube_api_hostname: fake
|
||||||
bootstrap_k8s_gateway_addr: 10.10.10.253
|
bootstrap_k8s_gateway_addr: 10.10.10.253
|
||||||
bootstrap_external_ingress_addr: 10.10.10.252
|
bootstrap_external_ingress_addr: 10.10.10.252
|
||||||
bootstrap_internal_ingress_addr: 10.10.10.251
|
bootstrap_internal_ingress_addr: 10.10.10.251
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ bootstrap_cloudflare_tunnel_secret: fake
|
|||||||
bootstrap_cloudflare_tunnel_id: fake
|
bootstrap_cloudflare_tunnel_id: fake
|
||||||
bootstrap_node_cidr: 10.10.10.0/24
|
bootstrap_node_cidr: 10.10.10.0/24
|
||||||
bootstrap_kube_api_addr: 10.10.10.254
|
bootstrap_kube_api_addr: 10.10.10.254
|
||||||
|
bootstrap_kube_api_hostname: fake
|
||||||
bootstrap_k8s_gateway_addr: 10.10.10.253
|
bootstrap_k8s_gateway_addr: 10.10.10.253
|
||||||
bootstrap_external_ingress_addr: 10.10.10.252
|
bootstrap_external_ingress_addr: 10.10.10.252
|
||||||
bootstrap_internal_ingress_addr: 10.10.10.251
|
bootstrap_internal_ingress_addr: 10.10.10.251
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ bootstrap_cloudflare_tunnel_secret: fake
|
|||||||
bootstrap_cloudflare_tunnel_id: fake
|
bootstrap_cloudflare_tunnel_id: fake
|
||||||
bootstrap_node_cidr: 10.10.10.0/24
|
bootstrap_node_cidr: 10.10.10.0/24
|
||||||
bootstrap_kube_api_addr: 10.10.10.254
|
bootstrap_kube_api_addr: 10.10.10.254
|
||||||
|
bootstrap_kube_api_hostname: fake
|
||||||
bootstrap_k8s_gateway_addr: 10.10.10.253
|
bootstrap_k8s_gateway_addr: 10.10.10.253
|
||||||
bootstrap_external_ingress_addr: 10.10.10.252
|
bootstrap_external_ingress_addr: 10.10.10.252
|
||||||
bootstrap_internal_ingress_addr: 10.10.10.251
|
bootstrap_internal_ingress_addr: 10.10.10.251
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ bootstrap_cloudflare_tunnel_secret: fake
|
|||||||
bootstrap_cloudflare_tunnel_id: fake
|
bootstrap_cloudflare_tunnel_id: fake
|
||||||
bootstrap_node_cidr: 10.10.10.0/24
|
bootstrap_node_cidr: 10.10.10.0/24
|
||||||
bootstrap_kube_api_addr: # left blank to not use kube-vip
|
bootstrap_kube_api_addr: # left blank to not use kube-vip
|
||||||
|
bootstrap_kube_api_hostname: fake
|
||||||
bootstrap_k8s_gateway_addr: 10.10.10.253
|
bootstrap_k8s_gateway_addr: 10.10.10.253
|
||||||
bootstrap_external_ingress_addr: 10.10.10.252
|
bootstrap_external_ingress_addr: 10.10.10.252
|
||||||
bootstrap_internal_ingress_addr: 10.10.10.251
|
bootstrap_internal_ingress_addr: 10.10.10.251
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Query Github username
|
- name: Query Github username
|
||||||
|
when: not ci_test | default(false)
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: https://api.github.com/users/{{ bootstrap_github_username }}
|
url: https://api.github.com/users/{{ bootstrap_github_username }}
|
||||||
timeout: 5
|
timeout: 5
|
||||||
@@ -8,13 +9,14 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Check if username exists
|
- name: Check if username exists
|
||||||
|
when: not ci_test | default(false)
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: result.json.login == bootstrap_github_username
|
that: result.json.login == bootstrap_github_username
|
||||||
success_msg: Github user {{ bootstrap_github_username }} exists
|
success_msg: Github user {{ bootstrap_github_username }} exists
|
||||||
fail_msg: Github user {{ bootstrap_github_username }} does not exist
|
fail_msg: Github user {{ bootstrap_github_username }} does not exist
|
||||||
|
|
||||||
- name: Query Github repo
|
- name: Query Github repo
|
||||||
when: not bootstrap_private_github_repo | default(false)
|
when: (not ci_test | default(false)) or (not bootstrap_private_github_repo | default(false))
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: https://api.github.com/repos/{{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }}
|
url: https://api.github.com/repos/{{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }}
|
||||||
timeout: 5
|
timeout: 5
|
||||||
@@ -23,14 +25,14 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Check if repo exists
|
- name: Check if repo exists
|
||||||
when: not bootstrap_private_github_repo | default(false)
|
when: (not ci_test | default(false)) or (not bootstrap_private_github_repo | default(false))
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: result.json.full_name == bootstrap_github_username + '/' + bootstrap_github_repository_name
|
that: result.json.full_name == bootstrap_github_username + '/' + bootstrap_github_repository_name
|
||||||
success_msg: Github repo {{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }} exists
|
success_msg: Github repo {{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }} exists
|
||||||
fail_msg: Github repo {{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }} does not exist
|
fail_msg: Github repo {{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }} does not exist
|
||||||
|
|
||||||
- name: Query Github repo branch
|
- name: Query Github repo branch
|
||||||
when: not bootstrap_private_github_repo | default(false)
|
when: (not ci_test | default(false)) or (not bootstrap_private_github_repo | default(false))
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: https://api.github.com/repos/{{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }}/branches/{{ bootstrap_github_repository_branch | default('main', true) }}
|
url: https://api.github.com/repos/{{ bootstrap_github_username }}/{{ bootstrap_github_repository_name }}/branches/{{ bootstrap_github_repository_branch | default('main', true) }}
|
||||||
timeout: 5
|
timeout: 5
|
||||||
@@ -39,7 +41,7 @@
|
|||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Check if repo branch exists
|
- name: Check if repo branch exists
|
||||||
when: not bootstrap_private_github_repo | default(false)
|
when: (not ci_test | default(false)) or (not bootstrap_private_github_repo | default(false))
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that: result.json.name == bootstrap_github_repository_branch | default('main', true)
|
that: result.json.name == bootstrap_github_repository_branch | default('main', true)
|
||||||
success_msg: Github repo branch {{ bootstrap_github_repository_branch | default('main', true) }} exists
|
success_msg: Github repo branch {{ bootstrap_github_repository_branch | default('main', true) }} exists
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ k3s_registration_address: "{{ kube_api_addr }}"
|
|||||||
k3s_server_manifests_templates:
|
k3s_server_manifests_templates:
|
||||||
- custom-cilium-helmchart.yaml.j2
|
- custom-cilium-helmchart.yaml.j2
|
||||||
- custom-coredns-helmchart.yaml.j2
|
- custom-coredns-helmchart.yaml.j2
|
||||||
#% if bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr %#
|
#% if bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr | default('') %#
|
||||||
# /var/lib/rancher/k3s/server/manifests
|
# /var/lib/rancher/k3s/server/manifests
|
||||||
k3s_server_manifests_urls:
|
k3s_server_manifests_urls:
|
||||||
- url: https://raw.githubusercontent.com/kube-vip/website/main/content/manifests/rbac.yaml
|
- url: https://raw.githubusercontent.com/kube-vip/website/main/content/manifests/rbac.yaml
|
||||||
|
|||||||
@@ -2,11 +2,14 @@
|
|||||||
timezone: "#{ bootstrap_timezone }#"
|
timezone: "#{ bootstrap_timezone }#"
|
||||||
github_username: "#{ bootstrap_github_username }#"
|
github_username: "#{ bootstrap_github_username }#"
|
||||||
coredns_addr: "#{ bootstrap_service_cidr.split(',')[0] | nthhost(10) }#"
|
coredns_addr: "#{ bootstrap_service_cidr.split(',')[0] | nthhost(10) }#"
|
||||||
#% if bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr %#
|
#% if bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr | default('') %#
|
||||||
kube_api_addr: "#{ bootstrap_kube_api_addr }#"
|
kube_api_addr: "#{ bootstrap_kube_api_addr }#"
|
||||||
#% else %#
|
#% else %#
|
||||||
kube_api_addr: "#{ bootstrap_nodes.master[0].address }#"
|
kube_api_addr: "#{ bootstrap_nodes.master[0].address }#"
|
||||||
#% endif %#
|
#% endif %#
|
||||||
|
#% if bootstrap_kube_api_hostname | default('') %#
|
||||||
|
kube_api_hostname: "#{ bootstrap_kube_api_hostname }#"
|
||||||
|
#% endif %#
|
||||||
cluster_cidr: "#{ bootstrap_cluster_cidr.split(',')[0] }#"
|
cluster_cidr: "#{ bootstrap_cluster_cidr.split(',')[0] }#"
|
||||||
service_cidr: "#{ bootstrap_service_cidr.split(',')[0] }#"
|
service_cidr: "#{ bootstrap_service_cidr.split(',')[0] }#"
|
||||||
node_cidr: "#{ bootstrap_node_cidr }#"
|
node_cidr: "#{ bootstrap_node_cidr }#"
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ k3s_server:
|
|||||||
#% endif %#
|
#% endif %#
|
||||||
tls-san:
|
tls-san:
|
||||||
- "{{ kube_api_addr }}"
|
- "{{ kube_api_addr }}"
|
||||||
|
#% if bootstrap_kube_api_hostname | default('') %#
|
||||||
|
- "{{ kube_api_hostname }}"
|
||||||
|
#% endif %#
|
||||||
docker: false
|
docker: false
|
||||||
flannel-backend: "none" # This needs to be in quotes
|
flannel-backend: "none" # This needs to be in quotes
|
||||||
disable:
|
disable:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#% if bootstrap_distribution == 'k3s' and (bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr) %#
|
#% if bootstrap_distribution == 'k3s' and (bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr | default('')) %#
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
|
|||||||
@@ -44,14 +44,14 @@ spec:
|
|||||||
api:
|
api:
|
||||||
sans:
|
sans:
|
||||||
- "#{ bootstrap_kube_api_addr }#"
|
- "#{ bootstrap_kube_api_addr }#"
|
||||||
#% if bootstrap_kube_api_hostname is defined %#
|
#% if bootstrap_kube_api_hostname | default('') %#
|
||||||
- "#{ bootstrap_kube_api_hostname }#"
|
- "#{ bootstrap_kube_api_hostname }#"
|
||||||
#% endif %#
|
#% endif %#
|
||||||
#% for item in bootstrap_nodes.master %#
|
#% for item in bootstrap_nodes.master %#
|
||||||
#% if item.address != bootstrap_kube_api_addr %#
|
#% if item.address != bootstrap_kube_api_addr %#
|
||||||
- "#{ item.address }#"
|
- "#{ item.address }#"
|
||||||
#% endif %#
|
#% endif %#
|
||||||
#% if (bootstrap_kube_api_hostname is not defined) or (item.name != bootstrap_kube_api_hostname) %#
|
#% if (not bootstrap_kube_api_hostname | default('')) or (item.name != bootstrap_kube_api_hostname | default('')) %#
|
||||||
- "#{ item.name }#"
|
- "#{ item.name }#"
|
||||||
#% endif %#
|
#% endif %#
|
||||||
#% endfor %#
|
#% endfor %#
|
||||||
@@ -90,10 +90,10 @@ spec:
|
|||||||
ipv6:
|
ipv6:
|
||||||
enabled: true
|
enabled: true
|
||||||
#% endif %#
|
#% endif %#
|
||||||
#% if bootstrap_nodes.master | length == 1 and not bootstrap_kube_api_addr %#
|
#% if bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr | default('') %#
|
||||||
k8sServiceHost: "#{ bootstrap_nodes.master[0].address }#"
|
|
||||||
#% else %#
|
|
||||||
k8sServiceHost: "#{ bootstrap_kube_api_addr }#"
|
k8sServiceHost: "#{ bootstrap_kube_api_addr }#"
|
||||||
|
#% else %#
|
||||||
|
k8sServiceHost: "#{ bootstrap_nodes.master[0].address }#"
|
||||||
#% endif %#
|
#% endif %#
|
||||||
k8sServicePort: 6443
|
k8sServicePort: 6443
|
||||||
kubeProxyReplacement: true
|
kubeProxyReplacement: true
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ metadata:
|
|||||||
data:
|
data:
|
||||||
TIMEZONE: "#{ bootstrap_timezone }#"
|
TIMEZONE: "#{ bootstrap_timezone }#"
|
||||||
COREDNS_ADDR: "#{ bootstrap_service_cidr.split(',')[0] | nthhost(10) }#"
|
COREDNS_ADDR: "#{ bootstrap_service_cidr.split(',')[0] | nthhost(10) }#"
|
||||||
#% if bootstrap_nodes.master | length == 1 and not bootstrap_kube_api_addr %#
|
#% if bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr | default('') %#
|
||||||
KUBE_API_ADDR: "#{ bootstrap_nodes.master[0].address }#"
|
|
||||||
#% else %#
|
|
||||||
KUBE_API_ADDR: "#{ bootstrap_kube_api_addr }#"
|
KUBE_API_ADDR: "#{ bootstrap_kube_api_addr }#"
|
||||||
|
#% else %#
|
||||||
|
KUBE_API_ADDR: "#{ bootstrap_nodes.master[0].address }#"
|
||||||
#% endif %#
|
#% endif %#
|
||||||
CLUSTER_CIDR: "#{ bootstrap_cluster_cidr.split(',')[0] }#"
|
CLUSTER_CIDR: "#{ bootstrap_cluster_cidr.split(',')[0] }#"
|
||||||
SERVICE_CIDR: "#{ bootstrap_service_cidr.split(',')[0] }#"
|
SERVICE_CIDR: "#{ bootstrap_service_cidr.split(',')[0] }#"
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Distribution can either be 'k3s' or 'k0s'
|
# Distribution can either be 'k3s' or 'k0s'
|
||||||
# Note that changing this to k0s will ignore `system_upgrade_controller` in the addons.
|
|
||||||
bootstrap_distribution: k3s
|
bootstrap_distribution: k3s
|
||||||
|
|
||||||
# Github username (e.g. onedr0p)
|
# Github username (e.g. onedr0p)
|
||||||
@@ -43,12 +42,12 @@ bootstrap_cloudflare_tunnel_id:
|
|||||||
# CIDR your nodes are on (e.g. 192.168.1.0/24)
|
# CIDR your nodes are on (e.g. 192.168.1.0/24)
|
||||||
bootstrap_node_cidr:
|
bootstrap_node_cidr:
|
||||||
# The IP address of the Kube API, choose an available IP in your nodes network that is not being used
|
# The IP address of the Kube API, choose an available IP in your nodes network that is not being used
|
||||||
# (Optional) Leave this blank if you are deploying a single master node, this will disable kube-vip in k3s
|
# Leave this blank if you are deploying a single master node, this will disable kube-vip in k3s
|
||||||
# or keepalived in k0s and use the master node IP instead
|
# and keepalived in k0s and use the master node IP instead
|
||||||
bootstrap_kube_api_addr:
|
bootstrap_kube_api_addr:
|
||||||
# The hostname of the Kube API, set this if you intend to call the Kube API by hostname rather than IP
|
# (Optional) The hostname of the Kube API, set this if you intend to call the Kube API by
|
||||||
# (Optional) This is currently only utilized in k0s and is added to the Kube API cert sans
|
# hostname rather than IP. Hostname is added to the Kube API cert sans
|
||||||
# bootstrap_kube_api_hostname:
|
bootstrap_kube_api_hostname:
|
||||||
# The Load balancer IP for k8s_gateway, choose an available IP in your nodes network that is not being used
|
# The Load balancer IP for k8s_gateway, choose an available IP in your nodes network that is not being used
|
||||||
bootstrap_k8s_gateway_addr:
|
bootstrap_k8s_gateway_addr:
|
||||||
# The Load balancer IP for external ingress, choose an available IP in your nodes network that is not being used
|
# The Load balancer IP for external ingress, choose an available IP in your nodes network that is not being used
|
||||||
|
|||||||
Reference in new issue
Block a user