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:
Devin Buhl authored and GitHub committed 2024-02-01 20:31:42 -05:00
1 parent cba35dc66a
commit 89673cd17b
55 files changed
+330 -302

No files matched your search

@@ -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 @@
main = lambda data: data.get("distribution") in ['k3s', 'talos']
main = lambda data: data.get("distribution", {}).get("type", "k3s") in ['k3s', 'talos']
@@ -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