-
Notifications
You must be signed in to change notification settings - Fork 0
/
taskfile.yaml
397 lines (366 loc) · 15.5 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
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
version: '3'
vars:
hubbleEnterpriseVersion: 1.11.9
hubbleUIEnterpriseVersion: 0.28.1
tasks:
init-linux-tooling:
platforms: [linux]
desc: install all needed tools for linux
cmds:
- sudo apt update
- sudo apt install coreutils
- curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.22.0/kind-linux-amd64
- sudo mv ./kind /usr/local/bin/kind
- sudo curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- sudo curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- sudo chmod +x ./kubectl
- sudo mv ./kubectl /usr/local/bin/kubectl
init-windows-tooling:
platforms: [windows]
desc: install all needed tools
cmds:
- cmd /c mkdir bin
- cmd /c $env:path+="$(pwd)\bin"
- curl -Lo ./bin/kubectl.exe https://dl.k8s.io/release/v1.29.2/bin/windows/amd64/kubectl.exe
- curl -Lo ./bin/kind.exe https://kind.sigs.k8s.io/dl/v0.22.0/kind-windows-amd64
- curl -Lo ./bin/helm.zip https://get.helm.sh/helm-v3.14.3-windows-amd64.zip
- powershell expand-archive ./bin/helm.zip ./bin
- powershell move-item ./bin/windows-amd64/helm.exe ./bin/helm.exe
init-update-wsl:
desc: update wsl
platforms: [windows]
cmds:
- wsl --update --pre-release
cluster-create-basic:
desc: Creates a basic kind cluster with ingress
output: prefixed
silent: true
vars:
TIMEOUT: 300s
deps:
- task: kind-create-cluster
vars:
config: ./cluster-config/default.yaml
cmds:
- task: deploy-ingress-nginx
- cmd: echo "cluster deployed"
cluster-create-cilium-enterprise:
desc: Creates a cluster with cilium enterprise and ingress
deps:
- task: kind-create-cluster
vars:
config: ./cluster-config/default-no-cni.yaml
cmds:
- task: deploy-cilium-enterprise
- task: deploy-hubble-enterprise
- task: deploy-ingress-nginx
- task: deploy-hubble-ui-enterprise
- task: show-ingress
deploy-argocd:
desc: deploys argocd
silent: true
vars:
TIMEOUT: 600s
deps:
- task: helm-repos
- task: kind-use-context
cmds:
- helm install argo-cd argo-cd/argo-cd -n argocd -f ./values/argo-cd.yaml --create-namespace
- kubectl wait --namespace argocd --for=condition=Ready pod -l="app.kubernetes.io/instance"=argo-cd --timeout=600s
- task: deploy-argocd-example-apps
- task: show-ingress
- task: show-secret
vars:
secret: "argocd-initial-admin-secret"
property: "{.data.password}"
namespace: "argocd"
desc: "argo admin password"
deploy-argo-rollouts:
desc: deploys argo rollouts
vars:
TIMEOUT: 600s
deps:
- task: helm-repos
- task: kind-use-context
cmds:
- helm install argo-rollouts argo-cd/argo-rollouts -n argo-rollouts -f ./values/argo-rollouts.yaml --create-namespace
- kubectl wait --namespace argo-rollouts --for=condition=Ready pod -l="app.kubernetes.io/instance"=argo-rollouts --timeout=600s
- task: show-ingress
deploy-argocd-example-apps:
desc: deploys the argocd apps and projects
deps:
- task: helm-repos
- task: kind-use-context
cmds:
- kubectl apply -f ./argo-resources/projects
- kubectl apply -f ./argo-resources/applications
deploy-cert-manager:
desc: deploys the certificate manager
deps:
- task: helm-repos
- task: kind-use-context
vars:
TIMEOUT: 600s
cmds:
- kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.3.1/cert-manager.yaml
- kubectl wait --namespace cert-manager --for=condition=ready pod -l=app.kubernetes.io/instance=cert-manager --timeout={{.TIMEOUT}}
deploy-cilium-enterprise:
desc: deploy cilium enterprise
deps:
- task: helm-repos
- task: kind-use-context
vars:
TIMEOUT: 600s
VERSION: 1.14.8
cmds:
- kubectl apply -f ./kubernetes/cilium/namespace.yaml
- helm install cilium-enterprise isovalent/cilium -f ./values/cilium-enterprise.yaml -n cilium-system --version {{.VERSION}}
- kubectl wait --namespace cilium-system --for=condition=ready pod -l=app.kubernetes.io/part-of=cilium --timeout={{.TIMEOUT}}
deploy-clickhouse-operator:
desc: deploy clickhouse operator
deps:
- task: helm-repos
- task: kind-use-context
vars:
TIMEOUT: 600s
VERSION: 0.20.3
cmds:
- helm install clickhouse-operator altinity-clickhouse-operator/altinity-clickhouse-operator --wait --namespace clickhouse-operator --create-namespace --set 'operator.env[0].name=WATCH_NAMESPACES,operator.env[0].value=hubble-timescape'
- kubectl wait --namespace clickhouse-operator --for=condition=ready pod -l=app.kubernetes.io/instance=clickhouse-operator --timeout={{.TIMEOUT}}
deploy-hubble-enterprise:
desc: deploy hubble enterprise
deps:
- task: helm-repos
- task: kind-use-context
vars:
TIMEOUT: 10m
VERSION: 1.11.9
cmds:
- helm install hubble-enterprise isovalent/hubble-enterprise -f ./values/hubble-enterprise.yaml -n cilium-system --version {{.hubbleEnterpriseVersion}}
- kubectl wait --namespace cilium-system --for=condition=ready pod -l=app.kubernetes.io/name=hubble-enterprise --timeout={{.TIMEOUT}}
deploy-hubble-ui-enterprise:
desc: deploy hubble ui enterprise
deps:
- task: helm-repos
- task: kind-use-context
vars:
TIMEOUT: 600s
VERSION: 0.28.1
cmds:
- helm install hubble-ui-enterprise isovalent/hubble-ui -f ./values/hubble-ui-enterprise.yaml -n cilium-system --version {{.hubbleUIEnterpriseVersion}}
- kubectl wait --namespace cilium-system --for=condition=ready pod -l=k8s-app=hubble-ui --timeout={{.TIMEOUT}}
- task: show-ingress
deploy-hubble-timescape:
desc: deploy hubble timescape
deps:
- task: helm-repos
- task: kind-use-context
vars:
TIMEOUT: 600s
VERSION: 1.2.2
cmds:
- task: deploy-minio
- helm upgrade hubble-enterprise isovalent/hubble-enterprise --wait --version {{.hubbleEnterpriseVersion}} -n cilium-system -f ./values/hubble-enterprise-timescape.yaml
- kubectl wait --namespace cilium-system --for=condition=ready pod -l=app.kubernetes.io/name=hubble-enterprise --timeout={{.TIMEOUT}}
- task: deploy-clickhouse-operator
- |
kubectl create namespace hubble-timescape
kubectl -n hubble-timescape create secret generic hubble-timescape-migrate-creds \
--from-literal CLICKHOUSE_PASSWORD=migrate-password
kubectl -n hubble-timescape create secret generic hubble-timescape-ingester-creds \
--from-literal AWS_ACCESS_KEY_ID=minio \
--from-literal AWS_SECRET_ACCESS_KEY=quickstart \
--from-literal AWS_REGION=dummy \
--from-literal CLICKHOUSE_PASSWORD=ingester-password
kubectl -n hubble-timescape create secret generic hubble-timescape-server-creds \
--from-literal CLICKHOUSE_PASSWORD=server-password
- helm install hubble-timescape isovalent/hubble-timescape --version {{.VERSION}} --namespace hubble-timescape --values ./values/hubble-timescape.yaml
- kubectl wait --namespace hubble-timescape --for=condition=ready pod -l=app.kubernetes.io/part-of=hubble-timescape --timeout={{.TIMEOUT}}
- helm upgrade hubble-ui-enterprise isovalent/hubble-ui --reuse-values --set timescape.enabled=true -n cilium-system --version {{.hubbleUIEnterpriseVersion}}
- kubectl wait --namespace cilium-system --for=condition=ready pod -l=k8s-app=hubble-ui --timeout={{.TIMEOUT}}
deploy-ingress-nginx:
desc: deploys the ingress-nginx controller
deps:
- task: helm-repos
- task: kind-use-context
vars:
TIMEOUT: 600s
cmds:
- helm install ingress-nginx ingress-nginx/ingress-nginx -f ./values/ingress-nginx.yaml -n ingress-nginx --create-namespace
- kubectl wait --namespace ingress-nginx --for=condition=ready pod -l=app.kubernetes.io/component=controller --timeout={{.TIMEOUT}}
deploy-metrics-server:
desc: deploy metrics-server
deps:
- task: helm-repos
- task: kind-use-context
vars:
TIMEOUT: 5m
cmds:
- helm install metrics-server metrics-server/metrics-server -f ./values/metrics-server.yaml --wait --version 3.12.0 --namespace metrics-server --create-namespace
- kubectl wait --namespace metrics-server --for=condition=ready pod -l=app.kubernetes.io/name=metrics-server
deploy-minio:
desc: deploy minio storrage (S3 compatible blob storage)
deps:
- task: helm-repos
- task: kind-use-context
vars:
TIMEOUT: 5m
cmds:
- helm install minio-operator minio/operator --wait --version 5.0.5 --namespace minio-operator --create-namespace
- helm install minio-tenant minio/tenant --wait --version 5.0.5 --namespace minio --create-namespace -f ./values/minio-tenant.yaml
- kubectl wait --for jsonpath='{.status.currentState}'=Initialized tenants quickstart -n minio --timeout={{.TIMEOUT}}
- task: show-ingress
deploy-vpa:
desc: deploy vpa
silent: true
vars:
TIMEOUT: 600s
deps:
- task: deploy-cert-manager
cmds:
- task: deploy-metrics-server
- kubectl apply -f ./kubernetes/vertical-pod-autoscaler
- kubectl wait --namespace kube-system --for=condition=ready pod -l=app=vpa-recommender --timeout={{.TIMEOUT}}
- kubectl wait --namespace kube-system --for=condition=ready pod -l=app=vpa-admission-controller --timeout={{.TIMEOUT}}
deploy-rabbitmq:
desc: deploy rabbitMQ operator and a rabbitmq cluster
silent: true
vars:
TIMEOUT: 10m
deps:
- task: deploy-cert-manager
cmds:
- kubectl apply -f https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml
- kubectl wait --namespace rabbitmq-system --for=condition=ready pod -l=app.kubernetes.io/name=rabbitmq-cluster-operator
- kubectl apply -f https://github.com/rabbitmq/messaging-topology-operator/releases/latest/download/messaging-topology-operator-with-certmanager.yaml
- kubectl wait --namespace rabbitmq-system --for=condition=ready pod -l=app.kubernetes.io/name=messaging-topology-operator
- kubectl apply -f ./kubernetes/rabbitmq/namespace.yaml
- kubectl apply -f ./kubernetes/rabbitmq
- kubectl wait --namespace rabbitmq-cluster --for=condition=ready pod -l=app.kubernetes.io/name=rabbitmq-cluster
- task: show-ingress
- task: show-secret
vars:
secret: "rabbitmq-cluster-default-user"
namespace: "rabbitmq-cluster"
property: "{.data.username}"
desc: "username:"
- task: show-secret
vars:
secret: "rabbitmq-cluster-default-user"
namespace: "rabbitmq-cluster"
property: "{.data.password}"
desc: "password:"
deploy-prometheus:
desc: deploy prometheus stack
silent: true
vars:
TIMEOUT: 600s
deps:
- task: kind-use-context
- task: helm-repos
cmds:
- helm install prometheus prometheus-community/kube-prometheus-stack --create-namespace --namespace monitoring -f ./values/prometheus-stack.yaml
- kubectl wait --namespace monitoring --for=condition=ready pod -l=app.kubernetes.io/instance=prometheus --timeout={{.TIMEOUT}}
- task: show-ingress
- task: show-secret
vars:
secret: "prometheus-grafana"
namespace: "monitoring"
property: "{.data.admin-user}"
desc: "username:"
- task: show-secret
vars:
secret: "prometheus-grafana"
namespace: "monitoring"
property: "{.data.admin-password}"
desc: "password:"
demo-argo-rollouts-blue-green:
desc: deploy argo rolouts blue-green demo
silent: true
vars:
TIMEOUT: 600s
deps:
- task: kind-use-context
cmds:
- task: deploy-argo-rollouts
- cmd: kubectl create ns demo-argo-rollouts-bluegreen
- cmd: kubectl apply -f ./kubernetes/demos/argo-rollouts/blue-green
- cmd: kubectl wait --namespace demo-argo-rollouts-bluegreen --for=condition=ready pod -l=app=bluegreen-demo --timeout={{.TIMEOUT}}
- task: show-ingress
demo-vertical-pod-autoscaler:
desc: vpa demo
vars:
TIMEOUT: 600s
deps:
- task: deploy-vpa
cmds:
- kubectl apply -f ./kubernetes/demos/vertical-pod-autoscaler/namespace.yaml
- kubectl apply -f ./kubernetes/demos/vertical-pod-autoscaler/
- cmd: kubectl wait --namespace demo-vpa --for=condition=ready pod -l=app=cpu-utilization-app --timeout={{.TIMEOUT}}
- kubectl get vpa -n demo-vpa
- echo "kubectl get pods -n demo-vpa --watch"
demo-wasm:
desc: wasm demo from github.com/KWasm/kwasm-operator
vars:
TIMEOUT: 600s
deps:
- task: kind-use-context
- task: helm-repos
cmds:
- helm install -n kwasm --create-namespace kwasm-operator kwasm/kwasm-operator
- cmd: kubectl wait --namespace kwasm --for=condition=ready pod -l=app.kubernetes.io/name=kwasm-operator --timeout={{.TIMEOUT}}
- kubectl annotate node kind-worker2 kwasm.sh/kwasm-node=true
- kubectl apply -f ./kubernetes/demos/wasm/namespace.yaml
- kubectl apply -f ./kubernetes/demos/wasm/
- kubectl apply -f https://raw.githubusercontent.com/KWasm/kwasm-operator/main/examples/kind/runtimeclass.yaml
- kubectl apply -f https://raw.githubusercontent.com/KWasm/kwasm-operator/main/examples/kind/pod.yaml -n wasm-demo
- task: show-ingress
- curl wasm-demo.127.0.0.1.nip.io
kind-use-context:
desc: set context to kind
cmds:
- kubectl config use-context kind-kind
kind-export-kubeconfig:
desc: Export kubeconfig
cmds:
- kind export kubeconfig
kind-destroy-cluster:
desc: Destroys the cluster
prompt: Are you sure to delete the cluster ?
cmds:
- kind delete cluster
kind-create-cluster:
desc: Creates a kind cluster
cmds:
- 'kind create cluster --config {{ .config }}'
- kind export kubeconfig --kubeconfig ~/.kube/config
ignore_error: true
helm-repos:
cmds:
- helm repo add altinity-clickhouse-operator https://docs.altinity.com/clickhouse-operator
- helm repo add argo-cd https://argoproj.github.io/argo-helm
- helm repo add crossplane-stable https://charts.crossplane.io/stable
- helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
- helm repo add isovalent https://helm.isovalent.com
- helm repo add kwasm http://kwasm.sh/kwasm-operator/
- helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
- helm repo add minio https://operator.min.io/
- helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
- helm repo update crossplane-stable argo-cd ingress-nginx isovalent kwasm metrics-server minio prometheus-community altinity-clickhouse-operator
internal: true
show-ingress:
desc: print all ingress urls
cmds:
- kubectl get ingress -A -o=jsonpath='{range .items[*]}http://{.spec.rules[0].host}{"\n"}{end}'
show-secret:
internal: true
silent: true
vars:
PWD:
sh: kubectl -n {{.namespace}} get secret {{.secret}} -o jsonpath='{{.property}}'
cmds:
- cmd: echo "{{.desc}}"
- cmd: powershell '[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("{{.PWD}}"))'
platforms: [windows]
- cmd: echo "{{.PWD}}" | base64 -d
platforms: [linux,darwin]