Files
auricom-home-cluster/.taskfiles/bootstrap/Taskfile.yaml
2025-01-12 02:00:10 +01:00

52 lines
2.4 KiB
YAML

---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: '3'
vars:
BOOTSTRAP_RESOURCES_DIR: '{{.ROOT_DIR}}/.taskfiles/bootstrap/resources'
CLUSTER_DIR: '{{.ROOT_DIR}}/kubernetes'
tasks:
base:
desc: Bootstrap Base Apps
cmds:
- until kubectl wait nodes --for=condition=Ready=False --all --timeout=10m; do sleep 5; done
- helmfile --quiet --file {{.CLUSTER_DIR}}/bootstrap/apps/helmfile.yaml apply --skip-diff-on-install --suppress-diff
- until kubectl wait nodes --for=condition=Ready --all --timeout=10m; do sleep 5; done
preconditions:
- talosctl config info
# - test -f {{.CLUSTER_DIR}}/talos/cluster-0/talosconfig
- test -f {{.CLUSTER_DIR}}/bootstrap/apps/helmfile.yaml
- which helmfile kubectl
# NOTE: Nodes must all be part of the Ceph cluster and Ceph disks must share the same disk model
rook:
desc: Bootstrap Rook-Ceph
cmds:
- minijinja-cli {{.BOOTSTRAP_RESOURCES_DIR}}/wipe-rook.yaml.j2 | kubectl apply --server-side --filename -
- until kubectl --namespace default get job/wipe-rook &>/dev/null; do sleep 5; done
- kubectl --namespace default wait job/wipe-rook --for=condition=complete --timeout=5m
- stern --namespace default job/wipe-rook --no-follow
- kubectl --namespace default delete job wipe-rook
env:
NODE_COUNT:
sh: talosctl config info --output json | jq --raw-output '.nodes | length'
preconditions:
- test -f {{.BOOTSTRAP_RESOURCES_DIR}}/wipe-rook.yaml.j2
- which jq kubectl minijinja-cli stern talosctl
flux:
desc: Bootstrap Flux
cmds:
- kubectl create namespace flux-system --dry-run=client -o yaml | kubectl apply --filename -
- cat {{.SOPS_AGE_KEY}} | kubectl --namespace flux-system create secret generic sops-age --from-file=age.agekey=/dev/stdin
- kubectl apply --server-side --kustomize {{.CLUSTER_DIR}}/bootstrap/flux
- SOPS_AGE_KEY_FILE={{.SOPS_AGE_KEY}} sops exec-file {{.CLUSTER_DIR}}/bootstrap/flux/github-deploy-key.sops.yaml "kubectl apply --server-side --filename {}"
- SOPS_AGE_KEY_FILE={{.SOPS_AGE_KEY}} sops exec-file {{.CLUSTER_DIR}}/flux/vars/cluster-secrets.sops.yaml "kubectl apply --server-side --filename {}"
- kubectl apply --server-side --filename ./flux/vars/cluster-settings.yaml
apps:
desc: Bootstrap Flux
- kubectl apply --server-side --kustomize {{.CLUSTER_DIR}}/flux/config