47 lines
1.3 KiB
YAML
47 lines
1.3 KiB
YAML
---
|
|
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
|
version: "3"
|
|
|
|
vars:
|
|
K0S_DIR: "{{.KUBERNETES_DIR}}/k0s"
|
|
K0S_CONFIG_FILE: "{{.K0S_DIR}}/k0sctl.yaml"
|
|
|
|
env:
|
|
DISABLE_TELEMETRY: "true"
|
|
DISABLE_UPGRADE_CHECK: "true"
|
|
|
|
tasks:
|
|
|
|
apply:
|
|
desc: Apply k0s cluster config
|
|
dir: "{{.K0S_DIR}}"
|
|
cmds:
|
|
- k0sctl apply --config {{.K0S_CONFIG_FILE}}
|
|
- task: kubeconfig
|
|
preconditions:
|
|
- { msg: "Missing K0s config file", sh: "test -f {{.K0S_CONFIG_FILE}}" }
|
|
|
|
nuke:
|
|
desc: Nuke the k0s cluster
|
|
dir: "{{.K0S_DIR}}"
|
|
cmd: k0sctl reset --config {{.K0S_CONFIG_FILE}}
|
|
preconditions:
|
|
- { msg: "Missing K0s config file", sh: "test -f {{.K0S_CONFIG_FILE}}" }
|
|
|
|
kubeconfig:
|
|
desc: Gets k0s kubeconfig
|
|
dir: "{{.K0S_DIR}}"
|
|
prompt: This will overwrite the existing kubeconfig... continue?
|
|
cmds:
|
|
- k0sctl kubeconfig --config {{.K0S_CONFIG_FILE}} > {{.KUBECONFIG_FILE}}
|
|
- sed -i {{if eq OS "darwin"}}''{{end}} 's|https://.+:6443|https://{{.endpoint}}:6443|g' {{.KUBECONFIG_FILE}}
|
|
vars:
|
|
endpoint:
|
|
sh: "yq '.cluster.endpoint_vip' {{.BOOTSTRAP_CONFIG_FILE}}"
|
|
preconditions:
|
|
- { msg: "Missing K0s config file", sh: "test -f {{.K0S_CONFIG_FILE}}" }
|
|
|
|
.reset:
|
|
internal: true
|
|
cmd: rm -rf {{.K0S_CONFIG_FILE}}
|