-
Notifications
You must be signed in to change notification settings - Fork 1
/
taskfile.yaml
48 lines (37 loc) · 1.33 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
version: '3'
env:
DOCKER_IMAGE: andreistefanciprian/pod-labeler-k8s-webhook
tasks:
undeploy:
cmds:
- kubectl -n default delete -f infra/secret.yaml --ignore-not-found=true
- kubectl -n default delete -f infra/deployment.yaml --ignore-not-found=true
build:
cmds:
- docker build -t {{.DOCKER_IMAGE}} . -f infra/Dockerfile
- docker image push {{.DOCKER_IMAGE}}
template:
cmds:
- sed -e 's@${LATEST_DIGEST}@'{{.IMAGE_DIGEST}}'@g' <"infra/deployment_template.yaml" > infra/deployment.yaml
deploy:
cmds:
- kubectl apply -f infra/secret.yaml -n default
- sed -e 's@${LATEST_DIGEST}@'{{.IMAGE_DIGEST}}'@g' <"infra/deployment_template.yaml" > infra/deployment.yaml
- kubectl apply -f infra/deployment.yaml -n default
register:
cmds:
- sed -e "s#\${CA_PEM_B64}#{{.CA_PEM_B64}}#g" < infra/webhook_template.yaml > infra/webhook.yaml
- kubectl apply -f infra/webhook.yaml
unregister:
cmds:
- kubectl delete -f infra/webhook.yaml --ignore-not-found=true
check:
cmds:
- kubectl get MutatingWebhookConfigurations
- kubectl get pods
- kubectl get secrets
vars:
IMAGE_DIGEST:
sh: docker image ls {{.DOCKER_IMAGE}} --digests | grep sha256 | awk '{print $3}' | head -n 1
CA_PEM_B64:
sh: openssl base64 -A < infra/ca.pem