auto select control plane node and --preserve for my single node cluster

This commit is contained in:
Joseph Hanson 2024-06-18 14:09:54 -05:00
parent 15fc6f4249
commit acb7bf085b
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o

View file

@ -48,8 +48,15 @@ tasks:
fetch-kubeconfig:
desc: Fetch kubeconfig from Talos controllers
vars:
CONTROLPLANE_NODE:
sh: |
talosctl --context {{.cluster}} config info \
| grep Endpoints: \
| awk '{split($0,u," "); print u[2]}' \
| sed -E 's/,//'
cmd: |
talosctl --context {{.cluster}} kubeconfig --nodes {{.controller}} \
talosctl --context {{.cluster}} kubeconfig --nodes {{.CONTROLPLANE_NODE}} \
--force --force-context-name {{.cluster}} {{.ROOT_DIR}}/kubeconfig
requires:
vars:
@ -86,7 +93,7 @@ tasks:
--env-file {{.KUBERNETES_DIR}}/bootstrap/talos/talenv.sops.yaml \
--config-file {{.KUBERNETES_DIR}}/bootstrap/talos/talconfig.yaml
cmds:
- talosctl --context {{.cluster}} upgrade -n {{.node}} --image {{.TALOS_IMAGE }}
- talosctl --context {{.cluster}} upgrade -n {{.node}} --image {{.TALOS_IMAGE }} --preserve # single node talos cluster needs to be preserved
requires:
vars:
- cluster