-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathTaskfile.yml
187 lines (169 loc) · 6.87 KB
/
Taskfile.yml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
version: '3'
silent: true
includes:
cli: ./tasks/cli.yaml
postgres: ./tasks/postgres.yaml
tailscale: ./tasks/tailscale.yaml
argocd: ./tasks/argocd.yaml
vault: ./tasks/vault.yaml
vultr: ./tasks/vultr.yaml
tf: ./tasks/terraform.yaml
secrets: ./tasks/secrets.yaml
cluster: ./tasks/cluster.yaml
matrix: ./tasks/matrix.yaml
test: ./tasks/test.yaml
talos: ./tasks/talos.yaml
commit: ./tasks/commit.yaml
milvus: ./tasks/milvus.yaml
vars:
PATH_ERROR: is not installed or correctly configured in PATH.
K8S_VERSION: 1.28.1
dotenv: ['.env']
tasks:
clear:
cmds:
- sleep 0.1 && {{.CLEAR}}
explain:
desc: Explains a certain Task command more in-detail
cmds:
- task {{.CLI_ARGS}} --summary
lint:
desc: Performs lint testing on the YAML files in the repository using the yamllint tool to ensure proper formatting and syntax.
preconditions:
- sh: "which yamllint"
msg: "yamllint {{.PATH_ERROR}}"
cmds:
- yamllint -c ./.yamllint .
docs:gen:
preconditions:
- sh: 'which terraform-docs'
msg: 'terraform-docs {{.PATH_ERROR}}'
dir: terraform
desc: Build documentation using Terraform-docs
cmds:
- terraform-docs markdown -c .terraform-docs.yaml . --output-file README.md
local:
desc: local-path storage
preconditions:
- sh: "which kustomize"
msg: "kustomize {{.PATH_ERROR}}"
cmds:
- kustomize build "github.com/rancher/local-path-provisioner/deploy?ref=v0.0.22" | kubectl apply -f -
validate:
preconditions:
- sh: "which kubeconform"
msg: "kubeconform {{.PATH_ERROR}}"
desc: Validates your Yaml objects in the repository using Kubeconform
cmds:
- |
objectTypes=("svc" "deployment" "*secret" "cm" "pvc" "pv" "role" "sa" "cr" "rb");
for obj in "${objectTypes[@]}"; do
echo -e "\nValidating ${obj^} object files";
find . -maxdepth 20 -name ${obj}.yaml -exec kubeconform -summary -exit-on-error -ignore-missing-schemas -kubernetes-version "{{.K8S_VERSION}}" -schema-location default {} \;
done
silent: true
calc:
preconditions:
- sh: "which kuota-calc"
msg: "kuota-calc {{.PATH_ERROR}}"
cmds:
- find . -maxdepth 50 -name deployment.yaml -exec cat {} \; | kuota-calc --detailed
- find . -maxdepth 50 -name statefulset.yaml -exec cat {} \; | kuota-calc --detailed
- find . -maxdepth 50 -name daemonset.yaml -exec cat {} \; | kuota-calc --detailed
test:k3d:
desc: Starts your local k3d cluster.
preconditions:
- sh: "which k3d"
msg: "k3d {{.PATH_ERROR}}"
summary: |
Creating a k3d cluster
This command ensures the cluster on k3d will
be created with all the correct parameters, allowing
for a declarative setup that requires minimal intervention
to work. k3d is configured to automatically create an entry
on your KUBECONFIG file and update it to point towards the cluster.
All commands that create resources also are specific to the cluster
name configured on the file ('k3d-demo'), as to avoid creating those
resoures on non-local clusters that may be on KUBECONFIG file as well.
cmds:
- task: cli:clear
- k3d cluster delete --config config/k3d.yaml
- k3d cluster create --config config/k3d.yaml
- task: cli:highlight_normal
- echo -e "\nYour cluster has been created. Type 'k3d cluster list' to confirm."
- task: cli:reset
ignore_error: true
test:k3d:destroy:
desc: Destroys your local k3d cluster.
preconditions:
- sh: "which k3d"
msg: "k3d {{.PATH_ERROR}}"
cmds:
- task: cli:clear
- k3d cluster delete --config config/k3d.yaml
- task: cli:highlight_normal
- echo -e "\nYour cluster has been destroyed."
- task: cli:reset
ignore_error: true
repos:
desc: Adds and updates all the required Helm repositories locally.
preconditions:
- sh: "which helm"
msg: "helm {{.PATH_ERROR}}"
cmds:
- task: cli:clear
- task: cli:highlight_bg
- echo -e "This will add new repositories to your local Helm\n"
- task: cli:reset
- helm repo add chaos-mesh https://charts.chaos-mesh.org
- helm repo add hashicorp https://helm.releases.hashicorp.com
- helm repo add bitnami https://charts.bitnami.com/bitnami
- helm repo add external-dns https://kubernetes-sigs.github.io/external-dns/
- helm repo add nginx-stable https://helm.nginx.com/stable
- helm repo add lwolf-charts http://charts.lwolf.org
- helm repo add emberstack https://emberstack.github.io/helm-charts
- helm repo add keyporttech https://keyporttech.github.io/helm-charts/
- helm repo add agones https://agones.dev/chart/stable
- helm repo add drone https://charts.drone.io
- helm repo add botkube https://charts.botkube.io
- helm repo add mysql-operator https://mysql.github.io/mysql-operator/
- helm repo add stakater https://stakater.github.io/stakater-charts
- helm repo add fairwinds-stable https://charts.fairwinds.com/stable
- helm repo add ananace-charts https://ananace.gitlab.io/charts
- helm repo add sealed-secrets https://bitnami-labs.github.io/sealed-secrets
- helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
- helm repo add pixie-operator https://pixie-operator-charts.storage.googleapis.com
- helm repo add eraser https://azure.github.io/eraser/charts
- helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts
- helm repo add mayastor https://openebs.github.io/mayastor-extensions/
- task: cli:clear
- echo -e "This will add new repositories to your local Helm\n"
- task: cli:highlight_normal
- echo -e "Finished adding repositories. Updating them now.\n"
- task: cli:reset
- helm repo update
ignore_error: true
dns:
desc: Creates the DNS entry required for the local domain to work.
preconditions:
- sh: "which hostctl"
msg: "hostctl {{.PATH_ERROR}}"
summary: |
Configuring Local DNS configuration through hostctl
This command uses hostctl to manage entries on /etc/hosts on a
a cross operational system compatible way. This command should work
on all MacOS, Windows and Linux. It adds all the '*.k8s.localhost'
domains to your local DNS hosts file. It also makes it easy for the
user to reverse those changes, avoiding pollution on your hosts
(or equivalent) file.
cmds:
- task: cli:clear
- sleep 0.01 && {{if eq OS "windows"}}hostctl add k8s -q < config/.etchosts{{else}}sudo hostctl add k8s -q < config/.etchosts{{end}}
- task: cli:highlight_normal
- echo -e "Added 'k8s.localhost' and related domains to your hosts file!"
- task: cli:reset
ignore_error: true
run:
cmds:
- task: validate
- task: commit