Skip to content

Commit

Permalink
chore(taskfiles): updating bootstrap tasks
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Kreitzer <[email protected]>
  • Loading branch information
buroa committed Jun 13, 2024
1 parent 5f80b8f commit 17cc1d7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
export KUBECONFIG="$(PWD)/kubernetes/kubeconfig"
export SOPS_AGE_KEY_FILE="$(PWD)/age.key"
export TALOSCONFIG="$(PWD)/talos/clusterconfig/talosconfig"
export TASK_X_MAP_VARIABLES=0
14 changes: 14 additions & 0 deletions .taskfiles/Bootstrap/Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
version: "3"

tasks:

k8s:
desc: Bootstrap K8s from start to finish
cmds:
- task: :talos:bootstrap
- task: :rook:reset
- task: :flux:bootstrap
preconditions:
- test -f {{.KUBERNETES_DIR}}/talosconfig
- talosctl config info >/dev/null 2>&1
10 changes: 5 additions & 5 deletions .taskfiles/Talos/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ x-vars: &vars
sh: talosctl config info --output json | jq --raw-output '.endpoints[]' | shuf -n 1

vars:
TALHELPER_SECRET_FILE: "{{.TALOS_DIR}}/talsecret.sops.yaml"
TALHELPER_CONFIG_FILE: "{{.TALOS_DIR}}/talconfig.yaml"
TALHELPER_SECRET_FILE: '{{.TALOS_DIR}}/talsecret.sops.yaml'
TALHELPER_CONFIG_FILE: '{{.TALOS_DIR}}/talconfig.yaml'

tasks:

Expand Down Expand Up @@ -107,7 +107,7 @@ tasks:
generate-secret:
desc: Generate Talos secret
prompt: This will overwrite the existing secret ... continue?
dir: "{{.TALOS_DIR}}"
dir: '{{.TALOS_DIR}}'
cmds:
- talhelper gensecret > {{.TALHELPER_SECRET_FILE}}
- sops --encrypt --in-place {{.TALHELPER_SECRET_FILE}}
Expand All @@ -116,14 +116,14 @@ tasks:

generate-config:
desc: Generate Talos config
dir: "{{.TALOS_DIR}}"
dir: '{{.TALOS_DIR}}'
cmd: talhelper genconfig
preconditions:
- test -f {{.TALHELPER_CONFIG_FILE}}

apply-config:
desc: Apply Talos config to the nodes
dir: "{{.TALOS_DIR}}"
dir: '{{.TALOS_DIR}}'
cmd: talhelper gencommand apply | bash
preconditions:
- test -f {{.TALHELPER_CONFIG_FILE}}
4 changes: 1 addition & 3 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
version: "3"

# TODO: Clean up `--context` usage
# Ref: https://github.com/go-task/task/issues/1038

vars:
KUBERNETES_DIR: "{{.ROOT_DIR}}/kubernetes"
TALOS_DIR: "{{.ROOT_DIR}}/talos"
Expand All @@ -13,6 +10,7 @@ env:
SOPS_AGE_KEY_FILE: "{{.ROOT_DIR}}/age.key"

includes:
bootstrap: .taskfiles/Bootstrap
external-secrets: .taskfiles/ExternalSecrets
flux: .taskfiles/Flux
kubernetes: .taskfiles/Kubernetes
Expand Down

0 comments on commit 17cc1d7

Please sign in to comment.