feat: add advanced features to config (#1208)

* feat: add advanced features to config

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: only enable longhorn if distro is k3s or k0s

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: update ansible lint

Signed-off-by: Devin Buhl <devin@buhl.casa>

---------

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl authored and GitHub committed 2024-01-20 12:27:20 -05:00
1 parent 0fda1f6a56
commit 1ec59d1559
87 files changed
+158 -145

No files matched your search

+2 -1
View File
@@ -1,5 +1,6 @@
#% if bootstrap_distribution == 'k3s' or bootstrap_distribution == 'k0s' %#
#% if bootstrap_distribution in ['k3s', 'k0s'] %#
skip_list:
- jinja[spacing]
- yaml[commas]
- yaml[line-length]
- var-naming
@@ -11,7 +11,7 @@ k3s_registration_address: "{{ kube_api_addr }}"
# /var/lib/rancher/k3s/server/manifests
k3s_server_manifests_templates:
- custom-cilium-helmchart.yaml.j2
#% if bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr | default('') %#
#% if bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr|default('') %#
# /var/lib/rancher/k3s/server/manifests
k3s_server_manifests_urls:
- url: https://raw.githubusercontent.com/kube-vip/website/main/content/manifests/rbac.yaml
@@ -1,20 +1,20 @@
#% if bootstrap_distribution == 'k3s' or bootstrap_distribution == 'k0s' %#
#% if bootstrap_distribution in ['k3s', 'k0s'] %#
---
timezone: "#{ bootstrap_timezone }#"
github_username: "#{ bootstrap_github_username }#"
coredns_addr: "#{ bootstrap_service_cidr.split(',')[0] | nthhost(10) }#"
#% if bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr | default('') %#
#% if bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr|default('') %#
kube_api_addr: "#{ bootstrap_kube_api_addr }#"
#% else %#
kube_api_addr: "#{ bootstrap_nodes.master[0].address }#"
#% endif %#
#% if bootstrap_kube_api_hostname | default('') %#
#% if bootstrap_kube_api_hostname|default('') %#
kube_api_hostname: "#{ bootstrap_kube_api_hostname }#"
#% 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) %#
#% if bootstrap_ipv6_enabled|default(false) %#
cluster_cidr_v6: "#{ bootstrap_cluster_cidr.split(',')[1] }#"
service_cidr_v6: "#{ bootstrap_service_cidr.split(',')[1] }#"
#% endif %#
@@ -4,14 +4,14 @@
# 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: "{{ ansible_host }},{{ ansible_default_ipv6.address }}"
#% else %#
node-ip: "{{ ansible_host }}"
#% endif %#
tls-san:
- "{{ kube_api_addr }}"
#% if bootstrap_kube_api_hostname | default('') %#
#% if bootstrap_kube_api_hostname|default('') %#
- "{{ kube_api_hostname }}"
#% endif %#
docker: false
@@ -23,7 +23,7 @@ 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: "{{ cluster_cidr }},{{ cluster_cidr_v6 }}"
service-cidr: "{{ service_cidr }},{{ service_cidr_v6 }}"
#% else %#
@@ -4,7 +4,7 @@
# 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: "{{ ansible_host }},{{ ansible_default_ipv6.address }}"
#% else %#
node-ip: "{{ ansible_host }}"
@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' or bootstrap_distribution == 'k0s' %#
#% if bootstrap_distribution in ['k3s', 'k0s'] %#
---
kubernetes:
children:
@@ -9,7 +9,7 @@ kubernetes:
ansible_user: "#{ item.username }#"
ansible_host: "#{ item.address }#"
#% endfor %#
#% if bootstrap_nodes.worker | default([]) | length > 0 %#
#% if bootstrap_nodes.worker|default([]) | length > 0 %#
worker:
hosts:
#% for item in bootstrap_nodes.worker %#
@@ -41,7 +41,7 @@
kubeconfig: /etc/rancher/k3s/k3s.yaml
kind: "{{ item.kind }}"
name: "{{ item.name }}"
namespace: "{{ item.namespace | default('') }}"
namespace: "{{ item.namespace|default('') }}"
wait: true
wait_sleep: 10
wait_timeout: 360
@@ -16,7 +16,7 @@
block:
- name: Locale | Set timezone
community.general.timezone:
name: "{{ timezone | default('Etc/UTC') }}"
name: "{{ timezone|default('Etc/UTC') }}"
- name: Packages
block:
@@ -62,6 +62,7 @@
ff02::2 ip6-allrouters
dest: /etc/hosts
mode: preserve
#% if bootstrap_advanced_flags|default({}) and bootstrap_advanced_flags.update_resolv_conf|default(true) %#
# https://github.com/onedr0p/flux-cluster-template/discussions/635
- name: Network Configuration | Remove immutable flag from /etc/resolv.conf
ansible.builtin.file:
@@ -79,7 +80,8 @@
dest: /etc/resolv.conf
content: |
search .
nameserver #{ bootstrap_dns_server | default('1.1.1.1', true) }#
nameserver #{ bootstrap_dns_server|default('1.1.1.1', true) }#
#% endif %#
- name: System Configuration
notify: Reboot
@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' or bootstrap_distribution == 'k0s' %#
#% if bootstrap_distribution in ['k3s', 'k0s'] %#
---
- name: Reboot
hosts: kubernetes
@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' or bootstrap_distribution == 'k0s' %#
#% if bootstrap_distribution in ['k3s', 'k0s'] %#
---
# https://github.com/kevincoakley/ansible-role-k8s-rolling-update
- name: Cluster rollout update
@@ -1,4 +1,4 @@
#% if bootstrap_distribution == 'k3s' and (bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr | default('')) %#
#% if bootstrap_distribution == 'k3s' and (bootstrap_nodes.master | length > 1 or bootstrap_kube_api_addr|default('')) %#
---
apiVersion: v1
kind: Pod