-
-
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
59 additions
and
47 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,66 @@ | ||
--- | ||
version: "3" | ||
|
||
vars: | ||
TALHELPER_SECRET_FILE: "{{.TALOS_DIR}}/talsecret.sops.yaml" | ||
TALHELPER_CONFIG_FILE: "{{.TALOS_DIR}}/talconfig.yaml" | ||
|
||
tasks: | ||
|
||
genconfig: | ||
desc: Generate talos config | ||
gensecret: | ||
desc: Generate Talos secret | ||
prompt: This will overwrite the existing secret... continue? | ||
dir: "{{.TALOS_DIR}}" | ||
cmds: | ||
- talhelper genconfig | ||
- 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}}" | ||
cmd: talhelper genconfig | ||
preconditions: | ||
- { msg: "Missing talhelper config file", sh: "test -f {{.TALHELPER_CONFIG_FILE}}" } | ||
|
||
apply-config: | ||
desc: Apply talos config on a node | ||
desc: Apply Talos config to the nodes | ||
dir: "{{.TALOS_DIR}}" | ||
cmd: talhelper gencommand apply | bash | ||
|
||
bootstrap: | ||
desc: Bootstrap the Talos cluster | ||
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" } | ||
- talhelper gencommand apply --extra-flags=--insecure | bash | ||
- talhelper gencommand bootstrap | bash | ||
|
||
upgrade-talos: | ||
desc: Upgrade talos on a node | ||
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}} 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") }}' | ||
- 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 | ||
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