-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
203 lines (177 loc) · 5.38 KB
/
Makefile
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# setup will run a targetted apply of terraform resources in lon and nyc to make the demo quicker
setup:
cd terraform/lon && terraform init
cd terraform/lon && terraform apply -target module.infra.civo_network.network -auto-approve
cd terraform/lon && terraform apply -target module.infra.civo_firewall.firewall -auto-approve
cd terraform/lon && terraform apply -target module.infra.civo_kubernetes_cluster.cluster -auto-approve
cd terraform/nyc && terraform init
cd terraform/nyc && terraform apply -target module.infra.civo_network.network -auto-approve
cd terraform/nyc && terraform apply -target module.infra.civo_firewall.firewall -auto-approve
cd terraform/nyc && terraform apply -target module.infra.civo_kubernetes_cluster.cluster -auto-approve
destroy:
cd terraform/lon && terraform destroy -auto-approve
cd terraform/nyc && terraform destroy -auto-approve
step1:
clear
@echo "Terraform Module for London"
@echo
cat terraform/lon/module.tf
@echo
step2:
@read -n 1 -s -p "Press any key to continue..."
@echo
@echo "Terraform Module for NYC"
@echo
cat terraform/nyc/module.tf
@echo
@read -n 1 -s -p "Press any key to continue..."
step3:
clear
@echo "Contents of the infra module"
@echo
ls -l terraform/modules/infra
@echo
@read -n 1 -s -p "Press any key to continue..."
step4:
clear
@echo "Contents of the infra module"
@echo
cat terraform/modules/infra/civo_network-network.tf
@echo
cat terraform/modules/infra/civo_firewall-cluster.tf
@echo
cat terraform/modules/infra/civo_kubernetes_cluster-cluster.tf
@echo
@read -n 1 -s -p "Press any key to continue..."
step5:
clear
@echo "Terraform plan the london module"
@echo
cd terraform/lon && terraform plan
@echo
@read -n 1 -s -p "Press any key to continue..."
step6:
clear
@echo "Terraform apply the london module"
@echo
cd terraform/lon && terraform apply -auto-approve
@echo
@read -n 1 -s -p "Press any key to continue..."
# plan the nyc module
step7:
clear
@echo "Terraform plan the nyc module"
@echo
cd terraform/nyc && terraform plan
@echo
@read -n 1 -s -p "Press any key to continue..."
# Apply the nyc module
step8:
clear
@echo "Terraform apply the nyc module"
@echo
cd terraform/nyc && terraform apply -auto-approve
@echo
@read -n 1 -s -p "Press any key to continue..."
# Show the nodes in the Lon cluster
step9:
clear
@echo "Nodes in the Lon cluster"
@echo
kubectl --kubeconfig=terraform/lon/kubeconfig get nodes
@echo
@read -n 1 -s -p "Press any key to continue..."
# Show the nodes in the NYC cluster
step10:
@echo
@echo "Nodes in the NYC cluster"
@echo
kubectl --kubeconfig=terraform/nyc/kubeconfig get nodes
@echo
@read -n 1 -s -p "Press any key to continue..."
# Show pods in the ArgoCD NS in lon
step11:
clear
@echo "Pods in the ArgoCD namespace in Lon"
@echo
kubectl --kubeconfig=terraform/lon/kubeconfig get pods -n argocd
@echo
@read -n 1 -s -p "Press any key to continue..."
# Show the appset in the argocd ns in lon
step12:
clear
@echo "Appset in the ArgoCD namespace in Lon"
@echo
kubectl --kubeconfig=terraform/lon/kubeconfig get appset -n argocd
@echo
@read -n 1 -s -p "Press any key to continue..."
# Get the jq path /spec/generators/0/git/directories from the appset in lon
step13:
clear
@echo "Application Deployment path in Lon"
@echo
kubectl --kubeconfig=terraform/lon/kubeconfig get appset -n argocd root -o json | jq '.spec.generators[0].git.directories'
@echo
@read -n 1 -s -p "Press any key to continue..."
# Get the jq path /spec/generators/0/git/directories from the appset in nyc
step14:
@echo
@echo "Application Deployment path in NYC"
@echo
kubectl --kubeconfig=terraform/nyc/kubeconfig get appset -n argocd root -o json | jq '.spec.generators[0].git.directories'
@echo
@read -n 1 -s -p "Press any key to continue..."
# Cat the files argo/argocd/env/lon/kustomization.yaml and argo/argocd/env/nyc/kustomization.yaml
step15:
clear
@echo "Contents of the kustomization.yaml files"
@echo
cat argo/argocd/env/lon/kustomization.yaml
@echo
cat argo/argocd/env/nyc/kustomization.yaml
@echo
@read -n 1 -s -p "Press any key to continue..."
step16:
clear
@echo "Applications in Lon"
@echo
find argo -type d -name 'lon'
@echo
@read -n 1 -s -p "Press any key to continue..."
# kubectl list the apps in the argocd ns in lon1
step17:
clear
@echo "Applications in Lon"
@echo
kubectl --kubeconfig=terraform/lon/kubeconfig get applications -n argocd
@echo
@read -n 1 -s -p "Press any key to continue..."
step18:
clear
@echo "Applications in NYC"
@echo
find argo -type d -name 'nyc'
@echo
@read -n 1 -s -p "Press any key to continue..."
step19:
clear
@echo "Applications in NYC"
@echo
kubectl --kubeconfig=terraform/nyc/kubeconfig get applications -n argocd
@echo
# get all pods in all namespaces in both clusters
step20:
clear
@echo "Pods in all namespaces in Lon"
@echo
kubectl --kubeconfig=terraform/lon/kubeconfig get pods --all-namespaces
@echo
@read -n 1 -s -p "Press any key to continue..."
clear
@echo "Pods in all namespaces in NYC"
@echo
kubectl --kubeconfig=terraform/nyc/kubeconfig get pods --all-namespaces
@echo
@read -n 1 -s -p "Press any key to continue..."
demo: step1 step2 step3 step4 step5 step6 step7 step8 step9 step10 step11 step12 step13 step14 step15 step16 step17 step18 step19 step20
.PHONY: demo destroy steup step1 step2 step3 step4 step5 step6 step7 step8 step9 step10 step11 step12 step13 step14 step15 step16 step17 step18 step19 step20