generated from onedr0p/cluster-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
101 lines (93 loc) · 3.24 KB
/
Taskfile.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
vars:
CLUSTER: '{{.CLUSTER | default "main"}}'
KUBERNETES_DIR: "{{.ROOT_DIR}}/kubernetes"
CLUSTER_DIR: '{{.ROOT_DIR}}/kubernetes/{{.CLUSTER}}'
AGE_FILE: "{{.ROOT_DIR}}/age.key"
# BOOTSTRAP_CONFIG_FILE: "{{.ROOT_DIR}}/config.yaml"
# KUBECONFIG_FILE: "{{.KUBERNETES_DIR}}/kubeconfig"
# Binaries
PYTHON_BIN: python3
env:
KUBECONFIG: "{{.CLUSTER_DIR}}/kubeconfig"
TALOSCONFIG: '{{.CLUSTER_DIR}}/bootstrap/talos/clusterconfig/talosconfig'
PYTHONDONTWRITEBYTECODE: "1"
SOPS_AGE_KEY_FILE: "{{.AGE_FILE}}"
VIRTUAL_ENV: "{{.ROOT_DIR}}/.venv"
includes:
ansible: .taskfiles/Ansible/Taskfile.yaml
external-secrets:
aliases: ["es"]
taskfile: .taskfiles/ExternalSecrets/Taskfile.yaml
kubernetes:
aliases: ["k8s"]
taskfile: .taskfiles/Kubernetes/Taskfile.yaml
flux: .taskfiles/Flux/Taskfile.yaml
repository:
aliases: ["repo"]
taskfile: .taskfiles/Repository/Taskfile.yaml
talos: .taskfiles/Talos/Taskfile.yaml
sops: .taskfiles/Sops/Taskfile.yaml
postgres: .taskfiles/Postgresql
workstation: .taskfiles/Workstation/Taskfile.yaml
volsync: .taskfiles/VolSync/Taskfile.yaml
user:
taskfile: .taskfiles/User
optional: true
tasks:
default: task -l
init:
desc: Initialize configuration files
cmds:
- cp -n {{.BOOTSTRAP_CONFIG_FILE | replace ".yaml" ".sample.yaml"}} {{.MINI_BOOTSTRAP_CONFIG_FILE}}
- cmd: echo === Configuration file copied ===
- cmd: echo Proceed with updating the configuration files...
- cmd: echo {{.MINI_BOOTSTRAP_CONFIG_FILE}}
status:
- test -f "{{.MINI_BOOTSTRAP_CONFIG_FILE}}"
silent: true
configure:
desc: Configure repository from bootstrap vars
prompt: Any conflicting config in the root kubernetes and ansible directories will be overwritten... continue?
deps: ["workstation:direnv", "workstation:venv", "sops:age-keygen", "init"]
cmds:
- task: .template
- task: sops:encrypt
- task: .validate
.template:
internal: true
cmd: "{{.VIRTUAL_ENV}}/bin/makejinja"
preconditions:
- { msg: "Missing virtual environment", sh: "test -d {{.VIRTUAL_ENV}}" }
- {
msg: "Missing Makejinja config file",
sh: "test -f {{.MAKEJINJA_CONFIG_FILE}}",
}
- {
msg: "Missing Makejinja plugin file",
sh: "test -f {{.BOOTSTRAP_DIR}}/scripts/plugin.py",
}
- {
msg: "Missing bootstrap config file",
sh: "test -f {{.MINI_BOOTSTRAP_CONFIG_FILE}}",
}
.validate:
internal: true
cmds:
- task: kubernetes:kubeconform
- cmd: echo === Done rendering and validating YAML ===
- cmd: |
if [[ $KUBECONFIG != "{{.KUBECONFIG_FILE}}" ]]; then
echo WARNING: KUBECONFIG is not set to the expected value, this may cause conflicts.
fi
- cmd: |
if [[ $SOPS_AGE_KEY_FILE != "{{.AGE_FILE}}" ]]; then
echo WARNING: SOPS_AGE_KEY_FILE is not set to the expected value, this may cause conflicts.
fi
- cmd: |
if test -f ~/.config/sops/age/keys.txt; then
echo WARNING: SOPS Age key found in home directory, this may cause conflicts.
fi
silent: true