feat: replace ansible templating with makejinja (#1156)
This commit is contained in:
1 parent
a4731906d9
commit
f9481d6202
114 files changed
+555
-906
No files matched your search
File renamed without changes.
+4
-2
@@ -1,3 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
---
|
||||
#
|
||||
# Below vars are for the xanmanning.k3s role
|
||||
@@ -13,12 +14,12 @@ k3s_etcd_datastore: true
|
||||
{% else %}
|
||||
k3s_etcd_datastore: false
|
||||
{% endif %}
|
||||
k3s_registration_address: "{% raw %}{{ kubeapi_addr }}{% endraw %}"
|
||||
k3s_registration_address: "{% raw %}{{ kube_api_addr }}{% endraw %}"
|
||||
# /var/lib/rancher/k3s/server/manifests
|
||||
k3s_server_manifests_templates:
|
||||
- custom-cilium-helmchart.yaml.j2
|
||||
- custom-coredns-helmchart.yaml.j2
|
||||
{% if bootstrap_kube_vip_enabled | default(true) %}
|
||||
{% if bootstrap_nodes.master | length > 1 and not bootstrap_kube_api_addr %}
|
||||
# /var/lib/rancher/k3s/server/manifests
|
||||
k3s_server_manifests_urls:
|
||||
- url: https://raw.githubusercontent.com/kube-vip/website/main/content/manifests/rbac.yaml
|
||||
@@ -27,3 +28,4 @@ k3s_server_manifests_urls:
|
||||
k3s_server_pod_manifests_templates:
|
||||
- kube-vip-static-pod.yaml.j2
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
+6
-2
@@ -1,8 +1,12 @@
|
||||
---
|
||||
timezone: "{{ bootstrap_timezone }}"
|
||||
github_username: "{{ bootstrap_github_username }}"
|
||||
coredns_addr: "{{ bootstrap_service_cidr.split(',')[0] | ansible.utils.nthhost(10) }}"
|
||||
kubeapi_addr: "{{ bootstrap_kubeapi_addr }}"
|
||||
coredns_addr: "{{ bootstrap_service_cidr.split(',')[0] | nthhost(10) }}"
|
||||
{% if bootstrap_nodes.master | length == 1 and not bootstrap_kube_api_addr %}
|
||||
kube_api_addr: "{{ bootstrap_nodes.master[0].address }}"
|
||||
{% else %}
|
||||
kube_api_addr: "{{ bootstrap_kube_api_addr }}"
|
||||
{% endif %}
|
||||
cluster_cidr: "{{ bootstrap_cluster_cidr.split(',')[0] }}"
|
||||
service_cidr: "{{ bootstrap_service_cidr.split(',')[0] }}"
|
||||
node_cidr: "{{ bootstrap_node_cidr }}"
|
||||
+9
-7
@@ -1,16 +1,17 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
---
|
||||
# https://rancher.com/docs/k3s/latest/en/installation/install-options/server-config/
|
||||
# https://github.com/PyratLabs/ansible-role-k3s
|
||||
|
||||
k3s_control_node: true
|
||||
k3s_server:
|
||||
{% if bootstrap_ipv6_enabled | default(false) %}
|
||||
{% if bootstrap_ipv6_enabled | default(false) %}
|
||||
node-ip: "{% raw %}{{ ansible_host }},{{ ansible_default_ipv6.address }}{% endraw %}"
|
||||
{% else %}
|
||||
{% else %}
|
||||
node-ip: "{% raw %}{{ ansible_host }}{% endraw %}"
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
tls-san:
|
||||
- "{% raw %}{{ kubeapi_addr }}{% endraw %}"
|
||||
- "{% raw %}{{ kube_api_addr }}{% endraw %}"
|
||||
docker: false
|
||||
flannel-backend: "none" # This needs to be in quotes
|
||||
disable:
|
||||
@@ -26,13 +27,13 @@ k3s_server:
|
||||
write-kubeconfig-mode: "644"
|
||||
pause-image: registry.k8s.io/pause:3.9
|
||||
secrets-encryption: true
|
||||
{% if bootstrap_ipv6_enabled | default(false) %}
|
||||
{% if bootstrap_ipv6_enabled | default(false) %}
|
||||
cluster-cidr: "{% raw %}{{ cluster_cidr }},{{ cluster_cidr_v6 }}{% endraw %}"
|
||||
service-cidr: "{% raw %}{{ service_cidr }},{{ service_cidr_v6 }}{% endraw %}"
|
||||
{% else %}
|
||||
{% else %}
|
||||
cluster-cidr: "{% raw %}{{ cluster_cidr }}{% endraw %}"
|
||||
service-cidr: "{% raw %}{{ service_cidr }}{% endraw %}"
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
etcd-expose-metrics: true # Required to monitor etcd with kube-prometheus-stack
|
||||
kube-controller-manager-arg:
|
||||
- "bind-address=0.0.0.0" # Required to monitor kube-controller-manager with kube-prometheus-stack
|
||||
@@ -44,3 +45,4 @@ k3s_server:
|
||||
kubelet-arg:
|
||||
- "image-gc-high-threshold=55"
|
||||
- "image-gc-low-threshold=50"
|
||||
{% endif %}
|
||||
+5
-3
@@ -1,16 +1,18 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
---
|
||||
# https://rancher.com/docs/k3s/latest/en/installation/install-options/agent-config/
|
||||
# https://github.com/PyratLabs/ansible-role-k3s
|
||||
|
||||
k3s_control_node: false
|
||||
k3s_agent:
|
||||
{% if bootstrap_ipv6_enabled | default(false) %}
|
||||
{% if bootstrap_ipv6_enabled | default(false) %}
|
||||
node-ip: "{% raw %}{{ ansible_host }},{{ ansible_default_ipv6.address }}{% endraw %}"
|
||||
{% else %}
|
||||
{% else %}
|
||||
node-ip: "{% raw %}{{ ansible_host }}{% endraw %}"
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
pause-image: registry.k8s.io/pause:3.9
|
||||
# TODO: Move these options to a kubelet config file
|
||||
kubelet-arg:
|
||||
- "image-gc-high-threshold=55"
|
||||
- "image-gc-low-threshold=50"
|
||||
{% endif %}
|
||||
File renamed without changes.
Whitespace-only changes.
+2
@@ -1,3 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
---
|
||||
- name: Cluster Installation
|
||||
hosts: kubernetes
|
||||
@@ -59,3 +60,4 @@
|
||||
- name: Cruft
|
||||
when: k3s_primary_control_node
|
||||
ansible.builtin.include_tasks: tasks/cruft.yaml
|
||||
{% endif %}
|
||||
+2
@@ -1,3 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
---
|
||||
- name: Cluster kube-vip
|
||||
hosts: master
|
||||
@@ -22,3 +23,4 @@
|
||||
src: templates/kube-vip-static-pod.yaml.j2
|
||||
dest: "{% raw %}{{ k3s_server_pod_manifests_dir }}{% endraw %}/kube-vip-static-pod.yaml"
|
||||
mode: preserve
|
||||
{% endif %}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
@@ -1,3 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
---
|
||||
- name: Cilium
|
||||
block:
|
||||
@@ -54,3 +55,4 @@
|
||||
definition:
|
||||
metadata:
|
||||
finalizers: []
|
||||
{% endif %}
|
||||
+2
@@ -1,3 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
---
|
||||
- name: Coredns
|
||||
block:
|
||||
@@ -54,3 +55,4 @@
|
||||
definition:
|
||||
metadata:
|
||||
finalizers: []
|
||||
{% endif %}
|
||||
+2
@@ -1,3 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
---
|
||||
# https://github.com/k3s-io/k3s/issues/1971
|
||||
- name: Cruft
|
||||
@@ -30,3 +31,4 @@
|
||||
namespace: kube-system
|
||||
state: absent
|
||||
loop: "{% raw %}{{ addons_list.resources | selectattr('metadata.name', 'match', '^custom-.*') | list }}{% endraw %}"
|
||||
{% endif %}
|
||||
+2
@@ -1,3 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
---
|
||||
- name: Get absolute path to this Git repository # noqa: command-instead-of-module
|
||||
ansible.builtin.command: git rev-parse --show-toplevel
|
||||
@@ -24,3 +25,4 @@
|
||||
path: "{% raw %}{{ repository_path.stdout }}{% endraw %}/kubeconfig"
|
||||
regexp: https://127.0.0.1:6443
|
||||
replace: "https://{% raw %}{{ k3s_registration_address }}{% endraw %}:6443"
|
||||
{% endif %}
|
||||
+3
-1
@@ -1,3 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
---
|
||||
# https://docs.k3s.io/helm
|
||||
apiVersion: helm.cattle.io/v1
|
||||
@@ -36,7 +37,7 @@ spec:
|
||||
ipv6:
|
||||
enabled: true
|
||||
{% endif %}
|
||||
k8sServiceHost: "{% raw %}{{ kubeapi_addr }}{% endraw %}"
|
||||
k8sServiceHost: "{% raw %}{{ kube_api_addr }}{% endraw %}"
|
||||
k8sServicePort: 6443
|
||||
kubeProxyReplacement: true
|
||||
kubeProxyReplacementHealthzBindAddr: 0.0.0.0:10256
|
||||
@@ -61,3 +62,4 @@ spec:
|
||||
routingMode: native
|
||||
securityContext:
|
||||
privileged: true
|
||||
{% endif %}
|
||||
+2
@@ -1,3 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
---
|
||||
# https://docs.k3s.io/helm
|
||||
apiVersion: helm.cattle.io/v1
|
||||
@@ -75,3 +76,4 @@ spec:
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/instance: coredns
|
||||
{% endif %}
|
||||
+3
-1
@@ -1,3 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' and bootstrap_nodes.master | length > 1 and not bootstrap_kube_api_addr %}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
@@ -15,7 +16,7 @@ spec:
|
||||
args: ["manager"]
|
||||
env:
|
||||
- name: address
|
||||
value: "{% raw %}{{ kubeapi_addr }}{% endraw %}"
|
||||
value: "{% raw %}{{ kube_api_addr }}{% endraw %}"
|
||||
- name: vip_arp
|
||||
value: "true"
|
||||
- name: lb_enable
|
||||
@@ -57,3 +58,4 @@ spec:
|
||||
- name: kubeconfig
|
||||
hostPath:
|
||||
path: /etc/rancher/k3s/k3s.yaml
|
||||
{% endif %}
|
||||
Whitespace-only changes.
Reference in new issue
Block a user