-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(taskfiles): update talos tasks
Signed-off-by: Steven Kreitzer <[email protected]>
- Loading branch information
Showing
2 changed files
with
50 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,64 @@ | ||
--- | ||
version: "3" | ||
|
||
vars: | ||
TALHELPER_SECRET_FILE: "{{.TALOS_DIR}}/talsecret.sops.yaml" | ||
TALHELPER_CONFIG_FILE: "{{.TALOS_DIR}}/talconfig.yaml" | ||
|
||
tasks: | ||
|
||
gensecret: | ||
desc: Generate talos secret | ||
prompt: This will overwrite the existing secret... continue? | ||
dir: "{{.TALOS_DIR}}" | ||
cmds: | ||
- talhelper gensecret > {{.TALHELPER_SECRET_FILE}} | ||
- sops --encrypt --in-place {{.TALHELPER_SECRET_FILE}} | ||
preconditions: | ||
- { msg: "Missing talhelper config file", sh: "test -f {{.TALHELPER_CONFIG_FILE}}" } | ||
|
||
genconfig: | ||
desc: Generate talos config | ||
dir: "{{.TALOS_DIR}}" | ||
cmds: | ||
- talhelper genconfig | ||
cmd: talhelper genconfig | ||
preconditions: | ||
- { msg: "Missing talhelper config file", sh: "test -f {{.TALHELPER_CONFIG_FILE}}" } | ||
|
||
apply-config: | ||
desc: Apply talos config on a node | ||
dir: "{{.TALOS_DIR}}" | ||
cmd: talhelper gencommand apply --extra-flags=--insecure | bash | ||
|
||
bootstrap: | ||
desc: Bootstrap the talos cluster | ||
dir: "{{.TALOS_DIR}}" | ||
cmd: talhelper gencommand bootstrap | bash | ||
|
||
kubeconfig: | ||
desc: Generate talos kubeconfig | ||
prompt: This will overwrite the existing kubeconfig... continue? | ||
dir: "{{.TALOS_DIR}}" | ||
cmd: talosctl kubeconfig {{.ROOT_DIR}} --force | ||
|
||
apply-extras: | ||
desc: Apply extras | ||
dir: "{{.TALOS_DIR}}" | ||
cmds: | ||
- talosctl -n {{.node}} apply-config -f "{{.TALOS_DIR}}/clusterconfig/k8s-{{.node}}.yaml" | ||
vars: | ||
node: '{{ or .node (fail "Argument (node) is required") }}' | ||
preconditions: | ||
- { msg: "Node not found", sh: "talosctl -n {{.node}} get mc" } | ||
- { msg: "Talos config not found", sh: "test -f {{.TALOS_DIR}}/clusterconfig/k8s-{{.node}}.yaml" } | ||
- kubectl kustomize --enable-helm ./cni | kubectl apply --server-side --filename - | ||
- kubectl kustomize --enable-helm ./kubelet-csr-approver | kubectl apply --server-side --filename - | ||
|
||
upgrade-talos: | ||
desc: Upgrade talos on a node | ||
cmds: | ||
- talosctl -n {{.node}} upgrade --image {{.image}} --preserve=true --reboot-mode=powercycle | ||
vars: | ||
image: '{{ or .image (fail "Argument (image) is required") }}' | ||
node: '{{ or .node (fail "Argument (node) is required") }}' | ||
cmd: talosctl --nodes {{.node}} upgrade --image {{.image}} --preserve=true --reboot-mode=powercycle | ||
requires: | ||
vars: ["node", "to"] | ||
preconditions: | ||
- { msg: "Node not found", sh: "talosctl -n {{.node}} get mc" } | ||
- { msg: "Node not found", sh: "talosctl --nodes {{.node}} get machineconfig" } | ||
|
||
upgrade-k8s: | ||
desc: Upgrade k8s on a node | ||
cmds: | ||
- talosctl -n {{.node}} upgrade-k8s --to {{.to}} | ||
vars: | ||
node: '{{ or .node (fail "Argument (node) is required") }}' | ||
to: '{{ or .to (fail "Argument (to) is required") }}' | ||
cmd: talosctl --nodes {{.node}} upgrade-k8s --to {{.to}} | ||
requires: | ||
vars: ["node", "to"] | ||
preconditions: | ||
- { msg: "Node not found", sh: "talosctl -n {{.node}} get mc" } | ||
- { msg: "Node not found", sh: "talosctl --nodes {{.node}} get machineconfig" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters