1+ ---
2+ # yaml-language-server: $schema=https://taskfile.dev/schema.json
3+ version : " 3"
4+
5+ tasks :
6+ init :
7+ desc : Generate and encrypt Talos secrets
8+ cmds :
9+ - |
10+ if [ ! -f "talsecret.sops.yaml" ]; then
11+ echo "Generating new Talos secrets..."
12+ talhelper gensecret > talsecret.yaml
13+ echo "Encrypting secrets with PGP key..."
14+ sops --encrypt --pgp FAC8E7C3A2BC7DEE58A01C5928E1AB8AF0CF07A5 talsecret.yaml > talsecret.sops.yaml
15+ rm talsecret.yaml
16+ echo "✅ Secrets generated and encrypted"
17+ else
18+ echo "Secrets file already exists"
19+ fi
20+
21+ genconfig :
22+ desc : Generate Talos configuration files
23+ cmds :
24+ - talhelper genconfig
25+ preconditions :
26+ - sh : test -f talconfig.yaml
27+ msg : Missing talconfig.yaml
28+ - sh : test -f talsecret.sops.yaml
29+ msg : Missing talsecret.sops.yaml - run 'mise run init' first
30+
31+ apply :
32+ desc : Apply Talos configuration to nodes
33+ cmds :
34+ - talhelper gencommand apply | bash
35+ preconditions :
36+ - sh : test -d clusterconfig
37+ msg : Missing clusterconfig directory - run 'mise run genconfig' first
38+
39+ apply-insecure :
40+ desc : Apply Talos configuration to nodes in maintenance mode (initial install)
41+ cmds :
42+ - talhelper gencommand apply --extra-flags="--insecure" | bash
43+ preconditions :
44+ - sh : test -d clusterconfig
45+ msg : Missing clusterconfig directory - run 'mise run genconfig' first
46+
47+ bootstrap :
48+ desc : Bootstrap the etcd cluster on first node
49+ cmds :
50+ - talhelper gencommand bootstrap | bash
51+ preconditions :
52+ - sh : test -d clusterconfig
53+ msg : Missing clusterconfig directory - run 'mise run genconfig' first
54+
55+ kubeconfig :
56+ desc : Fetch kubeconfig from Talos cluster
57+ cmds :
58+ - talhelper gencommand kubeconfig --extra-flags="../../ --force" | bash
59+ - chmod 600 ../../kubeconfig
60+ preconditions :
61+ - sh : test -d clusterconfig
62+ msg : Missing clusterconfig directory
63+
64+ test-thunderbolt :
65+ desc : Test Thunderbolt network connectivity
66+ cmds :
67+ - echo "Testing Thunderbolt interfaces..."
68+ - talosctl --nodes rei get links | grep -E "thunderbolt|169.254" || echo "No Thunderbolt on rei"
69+ - talosctl --nodes asuka get links | grep -E "thunderbolt|169.254" || echo "No Thunderbolt on asuka"
70+ - talosctl --nodes kaji get links | grep -E "thunderbolt|169.254" || echo "No Thunderbolt on kaji"
71+
72+ discover-thunderbolt :
73+ desc : Discover Thunderbolt interfaces using kubectl-node-shell (requires running cluster)
74+ cmds :
75+ - |
76+ echo "=== Discovering Thunderbolt interfaces on all nodes ==="
77+ echo "Note: This requires kubectl-node-shell to be installed"
78+ echo ""
79+ for node in rei asuka kaji; do
80+ echo "=== Node: $node ==="
81+ kubectl node-shell $node -- sh -c 'ls -la /sys/bus/thunderbolt/devices/ 2>/dev/null || echo "No Thunderbolt devices found"'
82+ echo ""
83+ echo "Network interfaces with bus paths:"
84+ kubectl node-shell $node -- sh -c 'for iface in $(ls /sys/class/net/); do if [ "$iface" != "lo" ]; then echo -n "$iface: "; readlink /sys/class/net/$iface | grep -oE "[0-9]+-[0-9]+\.[0-9]+" || echo "Not Thunderbolt"; fi; done'
85+ echo ""
86+ done
87+ preconditions :
88+ - sh : kubectl get nodes
89+ msg : Cluster must be running
90+ - sh : which kubectl-node-shell
91+ msg : kubectl-node-shell must be installed (kubectl krew install node-shell)
92+
93+ deploy-thunderbolt-debug :
94+ desc : Deploy privileged DaemonSet for Thunderbolt debugging
95+ cmds :
96+ - kubectl apply -f thunderbolt-debug.yaml
97+ - echo "Waiting for pods to start..."
98+ - kubectl -n kube-system wait --for=condition=Ready pod -l app=thunderbolt-debug --timeout=60s
99+ - echo ""
100+ - echo "=== Thunderbolt Debug Pods Running ==="
101+ - kubectl -n kube-system get pods -l app=thunderbolt-debug -o wide
102+ preconditions :
103+ - sh : test -f thunderbolt-debug.yaml
104+ msg : thunderbolt-debug.yaml not found
105+ - sh : kubectl get nodes
106+ msg : Cluster must be running
107+
108+ cleanup-thunderbolt-debug :
109+ desc : Remove Thunderbolt debug DaemonSet
110+ cmd : kubectl delete -f thunderbolt-debug.yaml --ignore-not-found=true
111+
112+ generate-thunderbolt-patch :
113+ desc : Generate Thunderbolt patch file based on discovered interfaces
114+ cmds :
115+ - |
116+ echo "After discovering Thunderbolt interfaces, create patches/node/NODE-thunderbolt.yaml"
117+ echo "Example patch structure:"
118+ echo ""
119+ cat <<'EOF'
120+ # patches/node/rei-thunderbolt.yaml
121+ machine:
122+ network:
123+ interfaces:
124+ - deviceSelector:
125+ busPath: "0-1.0" # Replace with actual discovered bus path
126+ dhcp: false
127+ mtu: 65520
128+ addresses:
129+ - 169.254.255.101/32
130+ routes:
131+ - network: 169.254.255.102/32
132+ metric: 2048
133+ - deviceSelector:
134+ busPath: "0-3.0" # Replace with actual discovered bus path
135+ dhcp: false
136+ mtu: 65520
137+ addresses:
138+ - 169.254.255.101/32
139+ routes:
140+ - network: 169.254.255.103/32
141+ metric: 2048
142+ EOF
143+
144+ dashboard :
145+ desc : Open Talos dashboard
146+ cmd : talosctl dashboard --nodes rei,asuka,kaji
147+
148+ health :
149+ desc : Check cluster health
150+ cmd : talosctl health --server=false
151+
152+ reset :
153+ desc : Reset nodes back to maintenance mode (DESTRUCTIVE)
154+ prompt : This will destroy your cluster! Continue?
155+ cmd : talhelper gencommand reset --extra-flags="--reboot --system-labels-to-wipe STATE --system-labels-to-wipe EPHEMERAL --graceful=false --wait=false" | bash
156+
157+ upgrade :
158+ desc : Upgrade Talos on a node
159+ cmd : talosctl --nodes {{.node}} upgrade --image {{.image}} --wait=true --timeout=10m --preserve=true
160+ requires :
161+ vars : ["node", "image"]
162+ preconditions :
163+ - msg : Unable to connect to node
164+ sh : talosctl --nodes {{.node}} version
165+
166+ upgrade-k8s :
167+ desc : Upgrade Kubernetes across the cluster
168+ cmd : talosctl --nodes {{.controller}} upgrade-k8s --to {{.to}}
169+ requires :
170+ vars : ["controller", "to"]
171+ preconditions :
172+ - msg : Unable to connect to controller
173+ sh : talosctl --nodes {{.controller}} version
0 commit comments