/
Taskfile.yaml
74 lines (72 loc) · 2.19 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
# https://taskfile.dev
version: "3"
tasks:
write_kubeconfig:
cmds:
- mkdir -p {{.KUBECONFIG_DIR}}
- k3d kubeconfig get $K3D_CLUSTER_NAME > $KUBECONFIG
vars:
KUBECONFIG_DIR:
sh: dirname $KUBECONFIG
silent: true
reload_env:
cmds:
- source .env
silent: true
create_cluster:
cmds:
- k3d registry create "$REGISTRY_NAME" --port "$REGISTRY_PORT"
- k3d cluster create $K3D_CLUSTER_NAME -c cluster.yaml
- task: reload_env
# Docker push
- docker pull gcr.io/google-samples/hello-app:1.0
- docker tag gcr.io/google-samples/hello-app:1.0 "localhost:$REGISTRY_PORT/hello-app:1.0"
- docker push "localhost:$REGISTRY_PORT/hello-app:1.0"
## Sanity Checks
- |
kubectl create deployment hello-server \
--image="k3d-$REGISTRY_NAME:$REGISTRY_PORT/hello-app:1.0"
- kubectl rollout status deployment.apps/hello-server --timeout=30s
- kubectl delete deployment.apps/hello-server
silent: true
ignore_error: true
delete_cluster:
cmds:
- k3d cluster delete -c cluster.yaml
- k3d registry delete "$K3D_CLUSTER_NAME-registry.localhost"
silent: true
ignore_error: true
bootstrap:
silent: true
cmds:
- |
flux bootstrap github \
--owner=$GITHUB_USER \
--repository=flux-hello-world \
--branch=dev \
--personal \
--path=./clusters/dev
create_hello_world_source:
silent: true
generates:
- "$GITOPS_DEMO_HOME/clusters/dev/hello-world-source.yaml"
cmds:
- |
flux create source git hello-world \
--url=$HELLO_WORLD_APP_FORK_REPO \
--branch=main \
--interval=30s \
--export > $GITOPS_DEMO_HOME/clusters/dev/hello-world-source.yaml
create_hello_world_kustomization:
silent: true
generates:
- "$GITOPS_DEMO_HOME/clusters/dev/hello-world-kustomization.yaml"
cmds:
- |
flux create kustomization hello-world \
--target-namespace=default \
--source=hello-world \
--path="./config/serverless" \
--prune=true \
--interval=5m \
--export > $GITOPS_DEMO_HOME/clusters/dev/hello-world-kustomization.yaml