-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
103 lines (90 loc) · 3.18 KB
/
Taskfile.yml
File metadata and controls
103 lines (90 loc) · 3.18 KB
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
version: '3'
vars:
K8S_VERSION: rancher/k3s:v1.23.8-k3s2
tasks:
install-prerequisites:
desc: Install prerequisites (docker, kubectl, flux, k3d)
preconditions:
- sh: command -v brew
msg: Homebrew is required but it's not installed. Aborting.
cmds:
- brew install docker kubernetes-cli fluxcd/tap/flux k3d
silent: true
k8s:create-cluster1:
desc: Create a local k3s cluster (cluster-1)
cmds:
- >-
k3d cluster create gitops-example-cluster-1
--image "{{.K8S_VERSION}}"
--servers 1
--agents 2
--api-port 6550
--port "8080:80@loadbalancer"
--k3s-arg '--disable=traefik@server:0'
--k3s-arg '--flannel-backend=none@server:0'
--k3s-node-label "agent=true@agent:0,1"
--volume "$(pwd)/infrastructure/calico/calico.yaml:/var/lib/rancher/k3s/server/manifests/calico.yaml"
--wait
silent: true
k8s:use-local-k3s-context:
desc: Use the local k3s cluster (cluster-1) context
cmds:
- kubectl config use-context k3d-gitops-example-cluster-1
silent: true
k8s:delete-cluster1:
desc: Delete local k3s cluster (cluster-1)
cmds:
- k3d cluster delete gitops-example-cluster-1
silent: true
k8s:verify-calico:
deps: [k8s:use-local-k3s-context]
desc: Verify that calico controller is deployed to local k3s cluster (cluster-1)
cmds:
- watch kubectl -n kube-system get deployments/calico-kube-controllers
silent: true
flux:check-prerequisites:
deps: [k8s:use-local-k3s-context]
desc: Run flux pre check against the local k3s cluster (cluster-1)
cmds:
- flux check --pre
silent: true
flux:bootstrap-cluster1:
deps: [k8s:use-local-k3s-context]
desc: Bootstrap flux to local k3s cluster (cluster-1)
cmds:
- >-
flux bootstrap github
--context=k3d-gitops-example-cluster-1
--owner=${GITHUB_USER}
--repository=${GITHUB_REPO}
--branch=main
--personal=true
--private=false
--network-policy=false
--path=clusters/cluster-1
silent: true
flux:reconcile:
deps: [k8s:use-local-k3s-context]
desc: Trigger a sync of the flux-system and apply changes to local k3s cluster (cluster-1)
cmds:
- flux reconcile kustomization flux-system --with-source
flux:get-helmreleases:
deps: [k8s:use-local-k3s-context]
desc: List all Helm releases and their status in local k3s cluster (cluster-1)
cmds:
- flux get helmreleases -A
flux:get-kustomizations:
deps: [k8s:use-local-k3s-context]
desc: List all kustomizations and their status in local k3s cluster (cluster-1)
cmds:
- flux get kustomization -A
flux:get-helmrepositories:
deps: [k8s:use-local-k3s-context]
desc: List all Helm repositories and their status in local k3s cluster (cluster-1)
cmds:
- flux get sources helm -A
flux:get-gitrepositories:
deps: [k8s:use-local-k3s-context]
desc: List all Git repositories and their status in local k3s cluster (cluster-1)
cmds:
- flux get sources git -A