feat: remove the need for raw jinja blocks (#1158)
Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
1 parent
f9481d6202
commit
e6fbc6e128
92 files changed
+430
-441
No files matched your search
@@ -1,4 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
---
|
||||
#
|
||||
# Below vars are for the xanmanning.k3s role
|
||||
@@ -9,17 +9,17 @@
|
||||
k3s_release_version: "v1.29.0+k3s1"
|
||||
k3s_install_hard_links: true
|
||||
k3s_become: true
|
||||
{% if bootstrap_nodes.master | length > 1 %}
|
||||
<% if bootstrap_nodes.master | length > 1 %>
|
||||
k3s_etcd_datastore: true
|
||||
{% else %}
|
||||
<% else %>
|
||||
k3s_etcd_datastore: false
|
||||
{% endif %}
|
||||
k3s_registration_address: "{% raw %}{{ kube_api_addr }}{% endraw %}"
|
||||
<% endif %>
|
||||
k3s_registration_address: "{{ kube_api_addr }}"
|
||||
# /var/lib/rancher/k3s/server/manifests
|
||||
k3s_server_manifests_templates:
|
||||
- custom-cilium-helmchart.yaml.j2
|
||||
- custom-coredns-helmchart.yaml.j2
|
||||
{% if bootstrap_nodes.master | length > 1 and not bootstrap_kube_api_addr %}
|
||||
<% 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,5 +27,5 @@ k3s_server_manifests_urls:
|
||||
# /var/lib/rancher/k3s/agent/pod-manifests
|
||||
k3s_server_pod_manifests_templates:
|
||||
- kube-vip-static-pod.yaml.j2
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
<% endif %>
|
||||
@@ -1,16 +1,16 @@
|
||||
---
|
||||
timezone: "{{ bootstrap_timezone }}"
|
||||
github_username: "{{ bootstrap_github_username }}"
|
||||
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 }}"
|
||||
{% if bootstrap_ipv6_enabled | default(false) %}
|
||||
cluster_cidr_v6: "{{ bootstrap_cluster_cidr.split(',')[1] }}"
|
||||
service_cidr_v6: "{{ bootstrap_service_cidr.split(',')[1] }}"
|
||||
{% endif %}
|
||||
timezone: "<< bootstrap_timezone >>"
|
||||
github_username: "<< bootstrap_github_username >>"
|
||||
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 >>"
|
||||
<% if bootstrap_ipv6_enabled | default(false) %>
|
||||
cluster_cidr_v6: "<< bootstrap_cluster_cidr.split(',')[1] >>"
|
||||
service_cidr_v6: "<< bootstrap_service_cidr.split(',')[1] >>"
|
||||
<% endif %>
|
||||
@@ -1,17 +1,17 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
<% 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) %}
|
||||
node-ip: "{% raw %}{{ ansible_host }},{{ ansible_default_ipv6.address }}{% endraw %}"
|
||||
{% else %}
|
||||
node-ip: "{% raw %}{{ ansible_host }}{% endraw %}"
|
||||
{% endif %}
|
||||
<% if bootstrap_ipv6_enabled | default(false) %>
|
||||
node-ip: "{{ ansible_host }},{{ ansible_default_ipv6.address }}"
|
||||
<% else %>
|
||||
node-ip: "{{ ansible_host }}"
|
||||
<% endif %>
|
||||
tls-san:
|
||||
- "{% raw %}{{ kube_api_addr }}{% endraw %}"
|
||||
- "{{ kube_api_addr }}"
|
||||
docker: false
|
||||
flannel-backend: "none" # This needs to be in quotes
|
||||
disable:
|
||||
@@ -27,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) %}
|
||||
cluster-cidr: "{% raw %}{{ cluster_cidr }},{{ cluster_cidr_v6 }}{% endraw %}"
|
||||
service-cidr: "{% raw %}{{ service_cidr }},{{ service_cidr_v6 }}{% endraw %}"
|
||||
{% else %}
|
||||
cluster-cidr: "{% raw %}{{ cluster_cidr }}{% endraw %}"
|
||||
service-cidr: "{% raw %}{{ service_cidr }}{% endraw %}"
|
||||
{% endif %}
|
||||
<% if bootstrap_ipv6_enabled | default(false) %>
|
||||
cluster-cidr: "{{ cluster_cidr }},{{ cluster_cidr_v6 }}"
|
||||
service-cidr: "{{ service_cidr }},{{ service_cidr_v6 }}"
|
||||
<% else %>
|
||||
cluster-cidr: "{{ cluster_cidr }}"
|
||||
service-cidr: "{{ service_cidr }}"
|
||||
<% 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
|
||||
@@ -45,4 +45,4 @@ k3s_server:
|
||||
kubelet-arg:
|
||||
- "image-gc-high-threshold=55"
|
||||
- "image-gc-low-threshold=50"
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
@@ -1,18 +1,18 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
<% 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) %}
|
||||
node-ip: "{% raw %}{{ ansible_host }},{{ ansible_default_ipv6.address }}{% endraw %}"
|
||||
{% else %}
|
||||
node-ip: "{% raw %}{{ ansible_host }}{% endraw %}"
|
||||
{% endif %}
|
||||
<% if bootstrap_ipv6_enabled | default(false) %>
|
||||
node-ip: "{{ ansible_host }},{{ ansible_default_ipv6.address }}"
|
||||
<% else %>
|
||||
node-ip: "{{ ansible_host }}"
|
||||
<% 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 %}
|
||||
<% endif %>
|
||||
@@ -3,25 +3,25 @@ kubernetes:
|
||||
children:
|
||||
master:
|
||||
hosts:
|
||||
{% for item in bootstrap_nodes.master %}
|
||||
{{ item.name }}:
|
||||
ansible_user: {{ item.username }}
|
||||
{% if item.external_address is defined %}
|
||||
ansible_host: {{ item.external_address }}
|
||||
{% else %}
|
||||
ansible_host: {{ item.address }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if bootstrap_nodes.worker | default([]) | length > 0 %}
|
||||
<% for item in bootstrap_nodes.master %>
|
||||
<< item.name >>:
|
||||
ansible_user: << item.username >>
|
||||
<% if item.external_address is defined %>
|
||||
ansible_host: << item.external_address >>
|
||||
<% else %>
|
||||
ansible_host: << item.address >>
|
||||
<% endif %>
|
||||
<% endfor %>
|
||||
<% if bootstrap_nodes.worker | default([]) | length > 0 %>
|
||||
worker:
|
||||
hosts:
|
||||
{% for item in bootstrap_nodes.worker %}
|
||||
{{ item.name }}:
|
||||
ansible_user: {{ item.username }}
|
||||
{% if item.external_address is defined %}
|
||||
ansible_host: {{ item.external_address }}
|
||||
{% else %}
|
||||
ansible_host: {{ item.address }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<% for item in bootstrap_nodes.worker %>
|
||||
<< item.name >>:
|
||||
ansible_user: << item.username >>
|
||||
<% if item.external_address is defined %>
|
||||
ansible_host: << item.external_address >>
|
||||
<% else %>
|
||||
ansible_host: << item.address >>
|
||||
<% endif %>
|
||||
<% endfor %>
|
||||
<% endif %>
|
||||
@@ -1,4 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
---
|
||||
- name: Cluster Installation
|
||||
hosts: kubernetes
|
||||
@@ -39,9 +39,9 @@
|
||||
or k3s_server_manifests_urls | length > 0)
|
||||
kubernetes.core.k8s_info:
|
||||
kubeconfig: /etc/rancher/k3s/k3s.yaml
|
||||
kind: "{% raw %}{{ item.kind }}{% endraw %}"
|
||||
name: "{% raw %}{{ item.name }}{% endraw %}"
|
||||
namespace: "{% raw %}{{ item.namespace | default('') }}{% endraw %}"
|
||||
kind: "{{ item.kind }}"
|
||||
name: "{{ item.name }}"
|
||||
namespace: "{{ item.namespace | default('') }}"
|
||||
wait: true
|
||||
wait_sleep: 10
|
||||
wait_timeout: 360
|
||||
@@ -60,4 +60,4 @@
|
||||
- name: Cruft
|
||||
when: k3s_primary_control_node
|
||||
ansible.builtin.include_tasks: tasks/cruft.yaml
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
@@ -1,4 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
---
|
||||
- name: Cluster kube-vip
|
||||
hosts: master
|
||||
@@ -21,6 +21,6 @@
|
||||
- name: Upgrade kube-vip
|
||||
ansible.builtin.template:
|
||||
src: templates/kube-vip-static-pod.yaml.j2
|
||||
dest: "{% raw %}{{ k3s_server_pod_manifests_dir }}{% endraw %}/kube-vip-static-pod.yaml"
|
||||
dest: "{{ k3s_server_pod_manifests_dir }}/kube-vip-static-pod.yaml"
|
||||
mode: preserve
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
@@ -21,7 +21,7 @@
|
||||
ansible.builtin.pause:
|
||||
seconds: 5
|
||||
tasks:
|
||||
{% if bootstrap_distribution == "k3s" %}
|
||||
<% if bootstrap_distribution == "k3s" %>
|
||||
- name: Stop Kubernetes # noqa: ignore-errors
|
||||
ignore_errors: true
|
||||
block:
|
||||
@@ -31,24 +31,24 @@
|
||||
public: true
|
||||
vars:
|
||||
k3s_state: stopped
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
|
||||
# https://github.com/k3s-io/docs/blob/main/docs/installation/network-options.md
|
||||
- name: Networking
|
||||
block:
|
||||
- name: Networking | Delete Cilium links
|
||||
ansible.builtin.command:
|
||||
cmd: "ip link delete {% raw %}{{ item }}{% endraw %}"
|
||||
removes: "/sys/class/net/{% raw %}{{ item }}{% endraw %}"
|
||||
cmd: "ip link delete {{ item }}"
|
||||
removes: "/sys/class/net/{{ item }}"
|
||||
loop: ["cilium_host", "cilium_net", "cilium_vxlan"]
|
||||
- name: Networking | Flush iptables
|
||||
ansible.builtin.iptables:
|
||||
table: "{% raw %}{{ item }}{% endraw %}"
|
||||
table: "{{ item }}"
|
||||
flush: true
|
||||
loop: ["filter", "nat", "mangle", "raw"]
|
||||
- name: Networking | Flush ip6tables
|
||||
ansible.builtin.iptables:
|
||||
table: "{% raw %}{{ item }}{% endraw %}"
|
||||
table: "{{ item }}"
|
||||
flush: true
|
||||
ip_version: ipv6
|
||||
loop: ["filter", "nat", "mangle", "raw"]
|
||||
@@ -57,7 +57,7 @@
|
||||
path: /etc/cni/net.d
|
||||
state: absent
|
||||
|
||||
{% if bootstrap_distribution == "k3s" %}
|
||||
<% if bootstrap_distribution == "k3s" %>
|
||||
- name: Check to see if k3s-killall.sh exits
|
||||
ansible.builtin.stat:
|
||||
path: /usr/local/bin/k3s-killall.sh
|
||||
@@ -89,14 +89,14 @@
|
||||
- k3s_install_hard_links
|
||||
- not ansible_check_mode
|
||||
ansible.builtin.file:
|
||||
path: "{% raw %}{{ k3s_install_dir }}/{{ item }}{% endraw %}"
|
||||
path: "{{ k3s_install_dir }}/{{ item }}"
|
||||
state: absent
|
||||
loop: ["kubectl", "crictl", "ctr"]
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
|
||||
- name: Remove local storage path
|
||||
ansible.builtin.file:
|
||||
path: "{{ bootstrap_local_storage_path }}"
|
||||
path: "<< bootstrap_local_storage_path >>"
|
||||
state: absent
|
||||
|
||||
- name: Reboot
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
block:
|
||||
- name: Locale | Set timezone
|
||||
community.general.timezone:
|
||||
name: "{% raw %}{{ timezone | default('Etc/UTC') }}{% endraw %}"
|
||||
name: "{{ timezone | default('Etc/UTC') }}"
|
||||
|
||||
- name: Packages
|
||||
block:
|
||||
@@ -31,14 +31,14 @@
|
||||
block:
|
||||
- name: User Configuration | SSH keys
|
||||
ansible.posix.authorized_key:
|
||||
user: "{% raw %}{{ ansible_user }}{% endraw %}"
|
||||
key: "https://github.com/{% raw %}{{ github_username }}{% endraw %}.keys"
|
||||
user: "{{ ansible_user }}"
|
||||
key: "https://github.com/{{ github_username }}.keys"
|
||||
- name: User Configuration | Silence login
|
||||
ansible.builtin.file:
|
||||
dest: "{% raw %}{{ '/home/' + ansible_user if ansible_user != 'root' else '/root' }}{% endraw %}/.hushlogin"
|
||||
dest: "{{ '/home/' + ansible_user if ansible_user != 'root' else '/root' }}/.hushlogin"
|
||||
state: touch
|
||||
owner: "{% raw %}{{ ansible_user }}{% endraw %}"
|
||||
group: "{% raw %}{{ ansible_user }}{% endraw %}"
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
mode: "0644"
|
||||
modification_time: preserve
|
||||
access_time: preserve
|
||||
@@ -48,12 +48,12 @@
|
||||
block:
|
||||
- name: Network Configuration | Set hostname
|
||||
ansible.builtin.hostname:
|
||||
name: "{% raw %}{{ inventory_hostname }}{% endraw %}"
|
||||
name: "{{ inventory_hostname }}"
|
||||
- name: Network Configuration | Update hosts
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
127.0.0.1 localhost
|
||||
127.0.1.1 {% raw %}{{ inventory_hostname }}{% endraw %}
|
||||
127.0.1.1 {{ inventory_hostname }}
|
||||
|
||||
# The following lines are desirable for IPv6 capable hosts
|
||||
::1 localhost ip6-localhost ip6-loopback
|
||||
@@ -96,15 +96,15 @@
|
||||
masked: true
|
||||
- name: System Configuration | Disable swap
|
||||
ansible.posix.mount:
|
||||
name: "{% raw %}{{ item }}{% endraw %}"
|
||||
name: "{{ item }}"
|
||||
fstype: swap
|
||||
state: absent
|
||||
loop: ["none", "swap"]
|
||||
- name: System Configuration | Create Kernel modules
|
||||
ansible.builtin.copy:
|
||||
dest: "/etc/modules-load.d/{% raw %}{{ item }}{% endraw %}.conf"
|
||||
dest: "/etc/modules-load.d/{{ item }}.conf"
|
||||
mode: "0644"
|
||||
content: "{% raw %}{{ item }}{% endraw %}"
|
||||
content: "{{ item }}"
|
||||
loop: ["br_netfilter", "ceph", "ip_vs", "ip_vs_rr", "nbd", "overlay", "rbd"]
|
||||
register: modules_status
|
||||
- name: System Configuration | Reload Kernel modules # noqa: no-changed-when no-handler
|
||||
@@ -114,11 +114,11 @@
|
||||
state: restarted
|
||||
- name: System Configuration | Sysctl
|
||||
ansible.posix.sysctl:
|
||||
name: "{% raw %}{{ item.key }}{% endraw %}"
|
||||
value: "{% raw %}{{ item.value }}{% endraw %}"
|
||||
name: "{{ item.key }}"
|
||||
value: "{{ item.value }}"
|
||||
sysctl_file: /etc/sysctl.d/99-kubernetes.conf
|
||||
reload: true
|
||||
with_dict: "{% raw %}{{ sysctl_config }}{% endraw %}"
|
||||
with_dict: "{{ sysctl_config }}"
|
||||
vars:
|
||||
sysctl_config:
|
||||
fs.inotify.max_queued_events: 65536
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
seconds: 5
|
||||
tasks:
|
||||
- name: Details
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
ansible.builtin.command: "k3s kubectl get node {% raw %}{{ inventory_hostname }}{% endraw %} -o json"
|
||||
{% elif bootstrap_distribution == 'k0s' %}
|
||||
ansible.builtin.command: "k0s kubectl get node {% raw %}{{ inventory_hostname }}{% endraw %} -o json"
|
||||
{% endif %}
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
ansible.builtin.command: "k3s kubectl get node {{ inventory_hostname }} -o json"
|
||||
<% elif bootstrap_distribution == 'k0s' %>
|
||||
ansible.builtin.command: "k0s kubectl get node {{ inventory_hostname }} -o json"
|
||||
<% endif %>
|
||||
register: kubectl_get_node
|
||||
delegate_to: "{% raw %}{{ groups['master'][0] }}{% endraw %}"
|
||||
delegate_to: "{{ groups['master'][0] }}"
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
@@ -31,23 +31,23 @@
|
||||
block:
|
||||
- name: Cordon
|
||||
kubernetes.core.k8s_drain:
|
||||
name: "{% raw %}{{ inventory_hostname }}{% endraw %}"
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
name: "{{ inventory_hostname }}"
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
kubeconfig: /etc/rancher/k3s/k3s.yaml
|
||||
{% elif bootstrap_distribution == 'k0s' %}
|
||||
<% elif bootstrap_distribution == 'k0s' %>
|
||||
kubeconfig: /var/lib/k0s/pki/admin.conf
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
state: cordon
|
||||
delegate_to: "{% raw %}{{ groups['master'][0] }}{% endraw %}"
|
||||
delegate_to: "{{ groups['master'][0] }}"
|
||||
|
||||
- name: Drain
|
||||
kubernetes.core.k8s_drain:
|
||||
name: "{% raw %}{{ inventory_hostname }}{% endraw %}"
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
name: "{{ inventory_hostname }}"
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
kubeconfig: /etc/rancher/k3s/k3s.yaml
|
||||
{% elif bootstrap_distribution == 'k0s' %}
|
||||
<% elif bootstrap_distribution == 'k0s' %>
|
||||
kubeconfig: /var/lib/k0s/pki/admin.conf
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
state: drain
|
||||
delete_options:
|
||||
delete_emptydir_data: true
|
||||
@@ -57,7 +57,7 @@
|
||||
pod_selectors:
|
||||
# Rook Ceph
|
||||
- app!=rook-ceph-osd
|
||||
delegate_to: "{% raw %}{{ groups['master'][0] }}{% endraw %}"
|
||||
delegate_to: "{{ groups['master'][0] }}"
|
||||
|
||||
- name: Update
|
||||
ansible.builtin.apt:
|
||||
@@ -78,11 +78,11 @@
|
||||
|
||||
- name: Uncordon
|
||||
kubernetes.core.k8s_drain:
|
||||
name: "{% raw %}{{ inventory_hostname }}{% endraw %}"
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
name: "{{ inventory_hostname }}"
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
kubeconfig: /etc/rancher/k3s/k3s.yaml
|
||||
{% elif bootstrap_distribution == 'k0s' %}
|
||||
<% elif bootstrap_distribution == 'k0s' %>
|
||||
kubeconfig: /var/lib/k0s/pki/admin.conf
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
state: uncordon
|
||||
delegate_to: "{% raw %}{{ groups['master'][0] }}{% endraw %}"
|
||||
delegate_to: "{{ groups['master'][0] }}"
|
||||
@@ -1,4 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
---
|
||||
- name: Cilium
|
||||
block:
|
||||
@@ -55,4 +55,4 @@
|
||||
definition:
|
||||
metadata:
|
||||
finalizers: []
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
@@ -1,4 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
---
|
||||
- name: Coredns
|
||||
block:
|
||||
@@ -55,4 +55,4 @@
|
||||
definition:
|
||||
metadata:
|
||||
finalizers: []
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
@@ -1,11 +1,11 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
---
|
||||
# https://github.com/k3s-io/k3s/issues/1971
|
||||
- name: Cruft
|
||||
block:
|
||||
- name: Cruft | Get list of custom manifests
|
||||
ansible.builtin.find:
|
||||
paths: "{% raw %}{{ k3s_server_manifests_dir }}{% endraw %}"
|
||||
paths: "{{ k3s_server_manifests_dir }}"
|
||||
file_type: file
|
||||
use_regex: true
|
||||
patterns: ["^custom-.*"]
|
||||
@@ -13,9 +13,9 @@
|
||||
|
||||
- name: Cruft | Delete custom manifests
|
||||
ansible.builtin.file:
|
||||
path: "{% raw %}{{ item.path }}{% endraw %}"
|
||||
path: "{{ item.path }}"
|
||||
state: absent
|
||||
loop: "{% raw %}{{ custom_manifest.files }}{% endraw %}"
|
||||
loop: "{{ custom_manifest.files }}"
|
||||
|
||||
- name: Cruft | Get list of custom addons
|
||||
kubernetes.core.k8s_info:
|
||||
@@ -26,9 +26,9 @@
|
||||
- name: Cruft | Delete addons
|
||||
kubernetes.core.k8s:
|
||||
kubeconfig: /etc/rancher/k3s/k3s.yaml
|
||||
name: "{% raw %}{{ item.metadata.name }}{% endraw %}"
|
||||
name: "{{ item.metadata.name }}"
|
||||
kind: Addon
|
||||
namespace: kube-system
|
||||
state: absent
|
||||
loop: "{% raw %}{{ addons_list.resources | selectattr('metadata.name', 'match', '^custom-.*') | list }}{% endraw %}"
|
||||
{% endif %}
|
||||
loop: "{{ addons_list.resources | selectattr('metadata.name', 'match', '^custom-.*') | list }}"
|
||||
<% endif %>
|
||||
@@ -1,4 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
<% 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
|
||||
@@ -14,7 +14,7 @@
|
||||
when: k3s_primary_control_node
|
||||
ansible.builtin.fetch:
|
||||
src: /etc/rancher/k3s/k3s.yaml
|
||||
dest: "{% raw %}{{ repository_path.stdout }}{% endraw %}/kubeconfig"
|
||||
dest: "{{ repository_path.stdout }}/kubeconfig"
|
||||
flat: true
|
||||
|
||||
- name: Update kubeconfig with the correct load balancer address
|
||||
@@ -22,7 +22,7 @@
|
||||
become: false
|
||||
run_once: true
|
||||
ansible.builtin.replace:
|
||||
path: "{% raw %}{{ repository_path.stdout }}{% endraw %}/kubeconfig"
|
||||
path: "{{ repository_path.stdout }}/kubeconfig"
|
||||
regexp: https://127.0.0.1:6443
|
||||
replace: "https://{% raw %}{{ k3s_registration_address }}{% endraw %}:6443"
|
||||
{% endif %}
|
||||
replace: "https://{{ k3s_registration_address }}:6443"
|
||||
<% endif %>
|
||||
+11
-11
@@ -1,4 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
---
|
||||
# https://docs.k3s.io/helm
|
||||
apiVersion: helm.cattle.io/v1
|
||||
@@ -31,29 +31,29 @@ spec:
|
||||
enabled: false
|
||||
ipam:
|
||||
mode: kubernetes
|
||||
ipv4NativeRoutingCIDR: "{% raw %}{{ cluster_cidr }}{% endraw %}"
|
||||
{% if bootstrap_ipv6_enabled | default(false) %}
|
||||
ipv6NativeRoutingCIDR: "{% raw %}{{ cluster_cidr_v6 }}{% endraw %}"
|
||||
ipv4NativeRoutingCIDR: "{{ cluster_cidr }}"
|
||||
<% if bootstrap_ipv6_enabled | default(false) %>
|
||||
ipv6NativeRoutingCIDR: "{{ cluster_cidr_v6 }}"
|
||||
ipv6:
|
||||
enabled: true
|
||||
{% endif %}
|
||||
k8sServiceHost: "{% raw %}{{ kube_api_addr }}{% endraw %}"
|
||||
<% endif %>
|
||||
k8sServiceHost: "{{ kube_api_addr }}"
|
||||
k8sServicePort: 6443
|
||||
kubeProxyReplacement: true
|
||||
kubeProxyReplacementHealthzBindAddr: 0.0.0.0:10256
|
||||
l2announcements:
|
||||
{% if bootstrap_ipv6_enabled | default(false) %}
|
||||
<% if bootstrap_ipv6_enabled | default(false) %>
|
||||
enabled: false
|
||||
{% else %}
|
||||
<% else %>
|
||||
enabled: true
|
||||
# https://github.com/cilium/cilium/issues/26586
|
||||
leaseDuration: 120s
|
||||
leaseRenewDeadline: 60s
|
||||
leaseRetryPeriod: 1s
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
loadBalancer:
|
||||
algorithm: maglev
|
||||
mode: {{ bootstrap_cilium_loadbalancer_mode | default('dsr', true) }}
|
||||
mode: << bootstrap_cilium_loadbalancer_mode | default('dsr', true) >>
|
||||
localRedirectPolicy: true
|
||||
operator:
|
||||
replicas: 1
|
||||
@@ -62,4 +62,4 @@ spec:
|
||||
routingMode: native
|
||||
securityContext:
|
||||
privileged: true
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
@@ -1,4 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' %}
|
||||
<% if bootstrap_distribution == 'k3s' %>
|
||||
---
|
||||
# https://docs.k3s.io/helm
|
||||
apiVersion: helm.cattle.io/v1
|
||||
@@ -19,7 +19,7 @@ spec:
|
||||
k8sAppLabelOverride: kube-dns
|
||||
service:
|
||||
name: kube-dns
|
||||
clusterIP: "{% raw %}{{ coredns_addr }}{% endraw %}"
|
||||
clusterIP: "{{ coredns_addr }}"
|
||||
serviceAccount:
|
||||
create: true
|
||||
deployment:
|
||||
@@ -76,4 +76,4 @@ spec:
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/instance: coredns
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
@@ -1,4 +1,4 @@
|
||||
{% if bootstrap_distribution == 'k3s' and bootstrap_nodes.master | length > 1 and not bootstrap_kube_api_addr %}
|
||||
<% if bootstrap_distribution == 'k3s' and bootstrap_nodes.master | length > 1 and not bootstrap_kube_api_addr %>
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
@@ -16,7 +16,7 @@ spec:
|
||||
args: ["manager"]
|
||||
env:
|
||||
- name: address
|
||||
value: "{% raw %}{{ kube_api_addr }}{% endraw %}"
|
||||
value: "{{ kube_api_addr }}"
|
||||
- name: vip_arp
|
||||
value: "true"
|
||||
- name: lb_enable
|
||||
@@ -58,4 +58,4 @@ spec:
|
||||
- name: kubeconfig
|
||||
hostPath:
|
||||
path: /etc/rancher/k3s/k3s.yaml
|
||||
{% endif %}
|
||||
<% endif %>
|
||||
Reference in new issue
Block a user