-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTaskfile.yaml
82 lines (74 loc) · 2.41 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
version: '3'
vars:
CHAOS_TAG: "Chaos Studio Demo"
CHAOS_NODE_COUNT: 3
includes:
infra:
taskfile: ../basic/Taskfile.yaml
dir: ../basic
internal: true
tasks:
up:
desc: Creates a {{.CHAOS_TAG}} and Experiments
cmds:
- task: 'infra:up'
vars:
TAGS: '{{.CHAOS_TAG}}'
REGION: '{{.REGION}}'
COUNT: '{{.CHAOS_NODE_COUNT}}'
- task: deploy
vars:
REGION: '{{default "southcentralus" .CLI_ARGS}}'
deploy:
desc: Deploys Azure Chaos Experiments
cmds:
- task: creds
- task: extensions
- task: targets
- task: experiment
creds:
desc: Gets AKS credential file
cmds:
- az aks get-credentials -g {{.RG}} -n {{.AKS}} --overwrite-existing
- sed -i s/devicecode/azurecli/g ~/.kube/config
vars:
AKS:
sh: terraform -chdir=../basic output -raw AKS_CLUSTER_NAME
RG:
sh: az aks list --query "[?name=='{{.AKS}}']" | jq -r ".[].resourceGroup"
extensions:
desc: Installing Chaos Mesh via Helm
cmds:
- helm repo add chaos-mesh https://charts.chaos-mesh.org
- helm repo update
- kubectl create ns chaos-testing
- helm install chaos-mesh chaos-mesh/chaos-mesh --namespace=chaos-testing --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/containerd/containerd.sock
vars:
AKS:
sh: terraform -chdir=../basic output -raw AKS_CLUSTER_NAME
RG:
sh: az aks list --query "[?name=='{{.AKS}}']" | jq -r ".[].resourceGroup"
targets:
desc: On boards Chaos Extension onto AKS Cluster Resource
cmds:
- az group deployment create -n ChaosTargets -g {{.RG}} --template-file ./azuredeploy.deployment.json --parameters resourceName={{.AKS}}
vars:
AKS:
sh: terraform -chdir=../basic output -raw AKS_CLUSTER_NAME
RG:
sh: az aks list --query "[?name=='{{.AKS}}']" | jq -r ".[].resourceGroup"
experiment:
desc: Creates an Chaos Engineering
cmds:
- az group deployment create -n ChaosExperiment -g {{.RG}} --template-file ./azurechaos.experiment.json --parameters aksClusterName={{.AKS}}
vars:
AKS:
sh: terraform -chdir=../basic output -raw AKS_CLUSTER_NAME
RG:
sh: az aks list --query "[?name=='{{.AKS}}']" | jq -r ".[].resourceGroup"
down:
desc: Destroys all Azure resources and cleans up Terraform
cmds:
- task: 'infra:down'
vars:
TAGS: '{{.CHAOS_TAG}}'