-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTaskfile.yaml
96 lines (85 loc) · 3 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
version: "3"
dotenv: [".env"]
output: prefixed
silent: true
vars:
CLUSTER_NAME: istio-egress-gateway
CONTEXT_NAME: "k3d-{{.CLUSTER_NAME}}"
AGENT_NODE_NAME: k3d-{{.CLUSTER_NAME}}-agent
SERVER_NODE_NAME: k3d-{{.CLUSTER_NAME}}-server
ISTIO_VERSION: "1.7.8" # Match istio control plane version
ISTIOCTL: "istioctl --context={{.CONTEXT_NAME}}"
KUBECTL: "kubectl --context={{.CONTEXT_NAME}}"
tasks:
# _ _____ _
# | | _|___ / __| |
# | |/ / |_ \ / _` |
# | < ___) | (_| |
# |_|\_\____/ \__,_|
k3d:cluster:all:
prefix: ⚙️ > create
desc: Setup local k3d cluster and install all dependencies.
deps:
- k3d:cluster:create
- istio:install
k3d:cluster:create:
prefix: ⚙️ > create k3d cluster
desc: create k3d cluster
cmds:
- |
CLUSTER_ALREADY_EXISTS=$(k3d cluster list | grep {{.CLUSTER_NAME}})
if [ -z "$CLUSTER_ALREADY_EXISTS" ]; then
# cluster doesn't exist yet, so create it and install all CRDs
k3d cluster create --config=k3d/config.yaml
kubectl create ns istio-system
kubectl label --overwrite ns/default istio-injection=enabled
kubectl create ns cloud-main-system
kubectl create ns employee-ns && kubectl label --overwrite ns/employee-ns istio-injection=enabled
kubectl create ns non-employee-ns && kubectl label --overwrite ns/non-employee-ns istio-injection=enabled
else
echo Cluster {{.CLUSTER_NAME}} already exists.
fi
k3d:cluster:destroy:
prefix: ⚙️ > destroy
desc: destroy k3d cluster
cmds:
- "k3d cluster delete {{.CLUSTER_NAME}}"
k3d:start:
prefix: ⚙️ > start
desc: starts k3d cluster
cmds:
- "k3d cluster start {{.CLUSTER_NAME}}"
k3d:stop:
prefix: ⚙️ > stop
desc: stops k3d cluster
cmds:
- "k3d cluster stop {{.CLUSTER_NAME}}"
# _ _ _
# (_)___| |_(_) ___
# | / __| __| |/ _ \
# | \__ \ |_| | (_) |
# |_|___/\__|_|\___/
istioctl:install:
prefix: istioctl > install
desc: Downloads Istioctl onto the user's machine in $HOME/bin.
cmds:
- ISTIO_ALREADY_INSTALLED=$(command -v istioctl) && if [[ $ISTIO_ALREADY_INSTALLED ]]; then echo istioctl is already installed; else curl -L https://istio.io/downloadIstio | ISTIO_VERSION={{.ISTIO_VERSION}} TARGET_ARCH=x86_64 sh - && mv istio-{{.ISTIO_VERSION}}/bin/istioctl $HOME/bin && rm -r istio-{{.ISTIO_VERSION}}; fi
istio:operator-controller:
prefix: istio-operator chart
desc: Deploy Istio Operator Controller via helm chart.
deps:
- k3d:cluster:create
cmds:
- |
helm install istio-operator chart/ \
--set hub=docker.io/istio \
--set tag=1.7.8-distroless \
--set operatorNamespace=istio-operator \
--set watchedNamespaces=istio-system
istio:operator:
prefix: istio operator
desc: Installs Istio gateway onto the cluster using the Istio Operator.
deps:
- k3d:cluster:create
cmds:
- kubectl apply -f istio-operator.yaml