feat: distribution is a dict and nodes and cluster are top level (#1288)
* feat: distribution is a dict and nodes and cluster are top level Signed-off-by: Devin Buhl <devin@buhl.casa> * chore: housekeeping Signed-off-by: Devin Buhl <devin@buhl.casa> --------- Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
1 parent
cba35dc66a
commit
89673cd17b
55 files changed
+330
-302
No files matched your search
@@ -1 +1 @@
|
||||
main = lambda data: data.get("flux").get("enabled") == True
|
||||
main = lambda data: data.get("flux", {}).get("enabled", False) == True
|
||||
@@ -1 +1 @@
|
||||
main = lambda data: data.get("cloudflare").get("enabled") == True
|
||||
main = lambda data: data.get("cloudflare", {}).get("enabled", False) == True
|
||||
@@ -1 +0,0 @@
|
||||
main = lambda data: data.get("flux").get("github").get("webhook").get("enabled") == True
|
||||
@@ -3,4 +3,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- ./namespace.yaml
|
||||
{% if flux.github.webhook.enabled %}
|
||||
- ./webhooks/ks.yaml
|
||||
{% endif %}
|
||||
@@ -0,0 +1,6 @@
|
||||
main = lambda data: (
|
||||
data.get("flux", {})
|
||||
.get("github", {})
|
||||
.get("webhook", {})
|
||||
.get("enabled", False) == True
|
||||
)
|
||||
@@ -1 +1 @@
|
||||
main = lambda data: data.get("distribution") in ['talos']
|
||||
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ["talos"]
|
||||
@@ -4,11 +4,11 @@ kind: Kustomization
|
||||
resources:
|
||||
- ./namespace.yaml
|
||||
- ./cilium/ks.yaml
|
||||
{% if distribution in ['talos'] %}
|
||||
{% if distribution.type in ["talos"] %}
|
||||
- ./kubelet-csr-approver/ks.yaml
|
||||
{% endif %}
|
||||
- ./metrics-server/ks.yaml
|
||||
{% if distribution in ['k0s', 'talos'] %}
|
||||
{% if distribution.type in ["k0s", "talos"] %}
|
||||
- ./spegel/ks.yaml
|
||||
{% endif %}
|
||||
- ./reloader/ks.yaml
|
||||
@@ -1 +1 @@
|
||||
main = lambda data: data.get("distribution") in ['k0s', 'talos']
|
||||
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ["k0s", "talos"]
|
||||
@@ -24,10 +24,10 @@ spec:
|
||||
keepHistory: false
|
||||
values:
|
||||
spegel:
|
||||
{% if distribution in ['k0s'] %}
|
||||
{% if distribution.type in ["k0s"] %}
|
||||
containerdSock: /run/k0s/containerd.sock
|
||||
containerdRegistryConfigPath: /var/lib/k0s/containerd/certs.d
|
||||
{% elif distribution in ['talos'] %}
|
||||
{% elif distribution.type in ["talos"] %}
|
||||
containerdSock: /run/containerd/containerd.sock
|
||||
containerdRegistryConfigPath: /etc/cri/conf.d/hosts
|
||||
{% endif %}
|
||||
|
||||
@@ -1 +1 @@
|
||||
main = lambda data: data.get("cloudflare").get("enabled") == True
|
||||
main = lambda data: data.get("cloudflare", {}).get("enabled", False) == True
|
||||
@@ -1 +1 @@
|
||||
main = lambda data: data.get("distribution") in ['k0s']
|
||||
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ["k0s"]
|
||||
@@ -18,7 +18,7 @@ spec:
|
||||
controllers:
|
||||
discovery:
|
||||
selector: {}
|
||||
{% if cluster.nodes.inventory | selectattr('controller', 'equalto', False) | list | length %}
|
||||
{% if nodes.inventory | selectattr('controller', 'equalto', False) | list | length %}
|
||||
workers:
|
||||
discovery:
|
||||
selector: {}
|
||||
|
||||
@@ -1 +1 @@
|
||||
main = lambda data: data.get("distribution") in ['k3s']
|
||||
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ["k3s"]
|
||||
@@ -3,15 +3,15 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- ./namespace.yaml
|
||||
{% if distribution in ['k3s', 'talos'] %}
|
||||
{% if distribution.type in ['k3s', 'talos'] %}
|
||||
- ./system-upgrade-controller/ks.yaml
|
||||
{% endif %}
|
||||
{% if distribution in ['k0s'] %}
|
||||
{% if distribution.type in ["k0s"] %}
|
||||
- ./k0s/ks.yaml
|
||||
{% endif %}
|
||||
{% if distribution in ['k3s'] %}
|
||||
{% if distribution.type in ["k3s"] %}
|
||||
- ./k3s/ks.yaml
|
||||
{% endif %}
|
||||
{% if distribution in ['talos'] and cluster.nodes.talos.schematics.enabled %}
|
||||
{% if distribution.type in ["talos"] and nodes.talos.schematics.enabled %}
|
||||
- ./talos/ks.yaml
|
||||
{% endif %}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
main = lambda data: data.get("distribution") in ['k3s', 'talos']
|
||||
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ['k3s', 'talos']
|
||||
+1
-1
@@ -11,7 +11,7 @@ subjects:
|
||||
- kind: ServiceAccount
|
||||
name: system-upgrade
|
||||
namespace: system-upgrade
|
||||
{% if distribution in ['talos'] %}
|
||||
{% if distribution.type in ["talos"] %}
|
||||
---
|
||||
apiVersion: talos.dev/v1alpha1
|
||||
kind: ServiceAccount
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
main = lambda data: data.get("distribution") in ['talos'] and (
|
||||
data.get("cluster", {})
|
||||
.get("nodes", {})
|
||||
.get("talos", {})
|
||||
.get("schematics", {})
|
||||
.get("enabled", False) == True)
|
||||
main = lambda data: (
|
||||
data.get("distribution", {}).get("type", "k3s") in ["talos"] and
|
||||
data.get("distribution", {})
|
||||
.get("talos", {})
|
||||
.get("schematics", {})
|
||||
.get("enabled", False) == True
|
||||
)
|
||||
@@ -88,6 +88,6 @@ spec:
|
||||
args:
|
||||
- --nodes=$(NODE_IP)
|
||||
- upgrade
|
||||
- --image=factory.talos.dev/installer/{{ cluster.nodes.talos.schematics.id }}:$(SYSTEM_UPGRADE_PLAN_LATEST_VERSION)
|
||||
- --image=factory.talos.dev/installer/{{ nodes.talos.schematics.id }}:$(SYSTEM_UPGRADE_PLAN_LATEST_VERSION)
|
||||
- --preserve=true
|
||||
- --wait=false
|
||||
@@ -1 +1 @@
|
||||
main = lambda data: data.get("flux").get("enabled") == True
|
||||
main = lambda data: data.get("flux", {}).get("enabled", False) == True
|
||||
@@ -1 +1 @@
|
||||
main = lambda data: data.get("flux").get("enabled") == True
|
||||
main = lambda data: data.get("flux", {}).get("enabled", False) == True
|
||||
@@ -12,10 +12,10 @@ resources:
|
||||
- ./jetstack.yaml
|
||||
- ./metrics-server.yaml
|
||||
- ./openebs.yaml
|
||||
{% if distribution in ['talos'] %}
|
||||
{% if distribution.type in ["talos"] %}
|
||||
- ./postfinance.yaml
|
||||
{% endif %}
|
||||
- ./stakater.yaml
|
||||
{% if distribution in ['k0s', 'talos'] %}
|
||||
{% if distribution.type in ["k0s", "talos"] %}
|
||||
- ./xenitab.yaml
|
||||
{% endif %}
|
||||
@@ -1,4 +1,4 @@
|
||||
{% if distribution in ['talos'] %}
|
||||
{% if distribution.type in ["talos"] %}
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
kind: HelmRepository
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% if distribution in ['k0s', 'talos'] %}
|
||||
{% if distribution.type in ["k0s", "talos"] %}
|
||||
---
|
||||
apiVersion: source.toolkit.fluxcd.io/v1beta2
|
||||
kind: HelmRepository
|
||||
|
||||
@@ -7,7 +7,7 @@ metadata:
|
||||
data:
|
||||
TIMEZONE: "{{ timezone }}"
|
||||
CLUSTER_CIDR: "{{ cluster.pod_network.split(',')[0] }}"
|
||||
NODE_CIDR: "{{ cluster.nodes.host_network }}"
|
||||
NODE_CIDR: "{{ nodes.host_network }}"
|
||||
{% if feature_gates.dual_stack_ipv4_first %}
|
||||
CLUSTER_CIDR_V6: "{{ cluster.pod_network.split(',')[1] }}"
|
||||
{% endif %}
|
||||
@@ -1 +1 @@
|
||||
main = lambda data: data.get("distribution") in ['k0s']
|
||||
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ["k0s"]
|
||||
@@ -5,7 +5,7 @@ metadata:
|
||||
name: home-kubernetes
|
||||
spec:
|
||||
hosts:
|
||||
{% for item in cluster.nodes.inventory %}
|
||||
{% for item in nodes.inventory %}
|
||||
{% if item.controller %}
|
||||
- role: controller+worker
|
||||
{% else %}
|
||||
|
||||
@@ -35,8 +35,8 @@ apt-get install -y --no-install-recommends \
|
||||
chattr -i /etc/resolv.conf
|
||||
rm -f /etc/resolv.conf
|
||||
cat <<EOF > /etc/resolv.conf
|
||||
search {{ cluster.nodes.search_domain|default('.', true) }}
|
||||
{% for item in cluster.nodes.dns_servers %}
|
||||
search {{ nodes.search_domain|default('.', true) }}
|
||||
{% for item in nodes.dns_servers | default(['1.1.1.1', '1.0.0.1']) %}
|
||||
nameserver {{ item }}
|
||||
{% endfor %}
|
||||
EOF
|
||||
|
||||
@@ -1 +1 @@
|
||||
main = lambda data: data.get("distribution") in ['talos']
|
||||
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ["talos"]
|
||||
@@ -22,7 +22,7 @@ cniConfig:
|
||||
name: none
|
||||
|
||||
nodes:
|
||||
{% for item in cluster.nodes.inventory %}
|
||||
{% for item in nodes.inventory %}
|
||||
- hostname: "{{ item.name }}"
|
||||
ipAddress: "{{ item.address }}"
|
||||
{% if item.talos_disk_device.startswith('/') %}
|
||||
@@ -35,26 +35,26 @@ nodes:
|
||||
networkInterfaces:
|
||||
- interface: eth0
|
||||
dhcp: false
|
||||
{% if cluster.nodes.talos.vlan %}
|
||||
{% if distribution.talos.vlan %}
|
||||
vlans:
|
||||
- vlanId: {{ cluster.nodes.talos.vlan }}
|
||||
- vlanId: {{ distribution.talos.vlan }}
|
||||
addresses:
|
||||
- "{{ item.address }}/{{ cluster.nodes.host_network.split('/') | last }}"
|
||||
- "{{ item.address }}/{{ nodes.host_network.split('/') | last }}"
|
||||
mtu: 1500
|
||||
routes:
|
||||
- network: 0.0.0.0/0
|
||||
gateway: "{{ cluster.nodes.host_network | nthhost(1) }}"
|
||||
gateway: "{{ nodes.host_network | nthhost(1) }}"
|
||||
{% if item.controller %}
|
||||
vip:
|
||||
ip: "{{ cluster.endpoint_vip }}"
|
||||
{% endif %}
|
||||
{% else %}
|
||||
addresses:
|
||||
- "{{ item.address }}/{{ cluster.nodes.host_network.split('/') | last }}"
|
||||
- "{{ item.address }}/{{ nodes.host_network.split('/') | last }}"
|
||||
mtu: 1500
|
||||
routes:
|
||||
- network: 0.0.0.0/0
|
||||
gateway: "{{ cluster.nodes.host_network | nthhost(1) }}"
|
||||
gateway: "{{ nodes.host_network | nthhost(1) }}"
|
||||
{% if item.controller %}
|
||||
vip:
|
||||
ip: "{{ cluster.endpoint_vip }}"
|
||||
@@ -63,10 +63,10 @@ nodes:
|
||||
{% endfor %}
|
||||
|
||||
controlPlane:
|
||||
{% if cluster.nodes.talos.schematics.enabled %}
|
||||
{% if distribution.talos.schematics.enabled %}
|
||||
schematic:
|
||||
customization:
|
||||
{{ cluster.nodes.talos.schematics.customization | indent(6, first=True) }}
|
||||
{{ distribution.talos.schematics.customization | indent(6, first=True) }}
|
||||
{% endif %}
|
||||
patches:
|
||||
# Configure containerd
|
||||
@@ -110,7 +110,7 @@ controlPlane:
|
||||
rotate-server-certificates: true
|
||||
nodeIP:
|
||||
validSubnets:
|
||||
- "{{ cluster.nodes.host_network }}"
|
||||
- "{{ nodes.host_network }}"
|
||||
|
||||
# Enable KubePrism
|
||||
- &kubePrismPatch |-
|
||||
@@ -125,7 +125,7 @@ controlPlane:
|
||||
machine:
|
||||
network:
|
||||
nameservers:
|
||||
{% for item in cluster.nodes.dns_servers %}
|
||||
{% for item in nodes.dns_servers | default(['1.1.1.1', '1.0.0.1']) %}
|
||||
- {{ item }}
|
||||
{% endfor %}
|
||||
|
||||
@@ -165,7 +165,7 @@ controlPlane:
|
||||
extraArgs:
|
||||
listen-metrics-urls: http://0.0.0.0:2381
|
||||
advertisedSubnets:
|
||||
- "{{ cluster.nodes.host_network }}"
|
||||
- "{{ nodes.host_network }}"
|
||||
|
||||
# Disable default API server admission plugins.
|
||||
- |-
|
||||
@@ -183,12 +183,12 @@ controlPlane:
|
||||
allowedKubernetesNamespaces:
|
||||
- system-upgrade
|
||||
|
||||
{% if cluster.nodes.inventory | selectattr('controller', 'equalto', False) | list | length %}
|
||||
{% if nodes.inventory | selectattr('controller', 'equalto', False) | list | length %}
|
||||
worker:
|
||||
{% if cluster.nodes.talos.schematics.enabled %}
|
||||
{% if distribution.talos.schematics.enabled %}
|
||||
schematic:
|
||||
customization:
|
||||
{{ cluster.nodes.talos.schematics.customization | indent(6, first=True) }}
|
||||
{{ distribution.talos.schematics.customization | indent(6, first=True) }}
|
||||
{% endif %}
|
||||
patches:
|
||||
- *containerdPatch
|
||||
|
||||
Reference in new issue
Block a user