-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
242 lines (166 loc) · 7.46 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
.PHONY: prepare-mac pull-image router-provision one-provision two-provision three-provision four-provision k8s-uptime k8s-df k8s-reboot router-ssh one-ssh two-ssh three-ssh four-ssh setup teardown k8s-setup k8s-remove k8s-proxy k8s-dashboard-bearer-token-show k8s-dashboard-open
help: ## This help dialog.
@IFS=$$'\n' ; \
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \
printf "%-30s %s\n" "DevOps console for Project ceil" ; \
printf "%-30s %s\n" "===============================" ; \
printf "%-30s %s\n" "" ; \
printf "%-30s %s\n" "Target" "Help" ; \
printf "%-30s %s\n" "------" "----" ; \
for help_line in $${help_lines[@]}; do \
IFS=$$':' ; \
help_split=($$help_line) ; \
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
printf '\033[36m'; \
printf "%-30s %s" $$help_command ; \
printf '\033[0m'; \
printf "%s\n" $$help_info; \
done
%: # thanks to chakrit
@: # thanks to Wi.lliam Pursell
prepare-mac: ## Prepare mac for provisioning (install packages via brew)
workstation/prepare/mac
ansible-galaxy install -r k8s/requirements.yaml
pull-image: ## Pull
cd host/image && wget https://github.com/hypriot/image-builder-rpi/releases/download/v1.10.0/hypriotos-rpi-v1.10.0.img.zip
router-provision: ## Provision router for boot (flash SD card with OS)
host/provision/router
one-provision: ## Provision ks8 node one for boot (flash SD card with OS)
host/provision/one
two-provision: ## Provision ks8 node two for boot (flash SD card with OS)
host/provision/two
three-provision: ## Provision ks8 node three for boot (flash SD card with OS)
host/provision/three
four-provision: ## Provision ks8 node four for boot (flash SD card with OS)
host/provision/four
workstation-route-add: ## Add route to k8s subnet via router
router/scripts/route-to-subnet
workstation-route-del: ## Delete route to k8s subnet
router/scripts/route-to-subnet-delete
router-ssh: ## ssh to router
ssh admin@ceil-router.local
router-df: ## Show df of router
cd router && ansible -a "df -kh" all
router-uptime: ## Show uptime of router
cd router && ansible -a uptime all
router-reboot: ## Reboot ceil-router
cd router && ansible -a "shutdown -r now" all
router-check-ip: ## Check IP addresss of router
cd router && ansible -a "hostname --ip" all
router-setup: ## Setup router, .ovpn file will be downloaded into router/out
cd router && ansible-playbook setup.yml
router-traffic: ## Simulate traffic
cd router && ansible-playbook traffic.yml
router-piwatch-update: ## Build, push and run PiWatch
cd router && ansible-playbook piwatch.yml
router-piwatch-webhook-trigger: ## Trigger PiWatch webhook
python -mwebbrowser http://192.168.0.100/traffic/kubewatch-webhook
router-piwatch-docs-open: ## Open OAS3 docs of PiWatch
python -mwebbrowser http:/192.168.0.100/docs
one-ssh: ## ssh to one
ssh admin@ceil-one.dev
two-ssh: ## ssh to two
ssh admin@ceil-two.dev
three-ssh: ## ssh to three
ssh admin@ceil-three.dev
four-ssh: ## ssh to four
ssh admin@ceil-four.dev
k8s-ping: ## Ping nodes
cd k8s && ansible -m ping all
k8s-check-ip: ## Check IP addresses of nodes
cd k8s && ansible -a "hostname --ip" all
k8s-uptime: ## Show uptime of nodes
cd k8s && ansible -a uptime all
k8s-df: ## Show df of nodes
cd k8s && ansible -a "df -kh" all
k8s-reboot: ## Reboot all k8s nodes
cd k8s && ansible -a "shutdown -r now" all
k8s-setup: ## Setup cluster
cd k8s && ansible-playbook setup.yml
k8s-proxy: ## Open proxy
kubectl proxy
k8s-dashboard-bearer-token-show: ## Show dashboard bearer token
k8s/scripts/dashboard-bearer-token-show
k8s-dashboard-open: ## Open Dashboarrd
python -mwebbrowser http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/overview?namespace=default
k8s-remove: ## Remove previous installation of Kubernetes cluster
cd k8s && ansible-playbook remove.yml
thumb-wipe: ## Wipe all thump drives (YOU WILL LOSE ALL DATA ON ALL THUMB DRIVES)
cd k8s && ansible-playbook thumb-wipe.yml
gluster-heketi-setup: ## Setup GlusterFS + Heketi for dynamic volume provisioning as default storage class backed by thumb drives
cd k8s && ansible-playbook gluster-heketi-setup.yml
gluster-heketi-remove: ## Remove GlusterFS + Heketi incl. wiping thumb drives (YOU WILL LOSE ALL DATA ON ALL THUMB DRIVES)
cd k8s && ansible-playbook gluster-heketi-remove.yml
helm-setup: ## Init helm CLI and deploy tiller to cluster
cd k8s && ansible-playbook helm-setup.yml
helm-remove: ## Reset helm CLI and delete tiller from cluster
cd k8s && ansible-playbook helm-remove.yml
nodes-show: ## Show nodes
kubectl get nodes
pods-show: ## Show pods
kubectl get pods --all-namespaces -o wide
deployments-show: ## Show deployments
kubectl get deployments --all-namespaces
services-show: ## Show services
kubectl get services --all-namespaces
endpoints-show: ## Show endpoints
kubectl get endpoints --all-namespaces
metallb-deploy: ## Deploy MetalLB
deployment/metallb/deploy
metallb-delete: ## Delete MetalLB
deployment/metallb/delete
ingress-show: ## Show ingress
kubectl get ingress --all-namespaces
traefik-deploy: ## Deploy traefik ingress controller
deployment/traefik/deploy
traefik-delete: ## Delete traefik ingress controller
deployment/traefik/delete
traefik-ui-open: ## Open traefik UI
python -mwebbrowser http://traefik-ui.ceil.local
httpd-deploy: ## Deploy httpd
deployment/httpd/deploy
httpd-open: ## Open httpd
python -mwebbrowser http://httpd.ceil.local
httpd-delete: ## Delete httpd
deployment/httpd/delete
prometheus-deploy: ## Deploy prometheus
deployment/prometheus/deploy
prometheus-open: ## Open prometheus
python -mwebbrowser http://prometheus.ceil.local
python -mwebbrowser http://alertmanager.ceil.local
python -mwebbrowser http://pushgateway.ceil.local
prometheus-delete: ## Delete prometheus
deployment/prometheus/delete
grafana-deploy: ## Deploy grafana
deployment/grafana/deploy
grafana-admin-password-show: ## Show grafana password
kubectl get secret --namespace default grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
grafana-open: ## Open grafana
python -mwebbrowser http://grafana.ceil.local
grafana-delete: ## Delete grafana
deployment/grafana/delete
kubewatch-deploy: ## Deploy kubewatch
deployment/kubewatch/deploy
kubewatch-delete: ## Delete kubewatch
deployment/kubewatch/delete
podinfo-deploy: ## Deploy podinfo
deployment/podinfo/deploy
podinfo-delete: ## Delete podinfo
deployment/podinfo/delete
ngrok-deploy: ## Deploy ngrok
deployment/ngrok/deploy
ngrok-tunnel-port-exposed-show: ## Show port exposed by ngrok-tunnel
kubectl get --namespace ngrok -o jsonpath="{.spec.ports[0].nodePort}" services tunnel-ngrok
ngrok-status: ## Show ngrok status
python -mwebbrowser http://ceil-one.local:31742/status
ngrok-delete: ## Delete ngrok
deployment/ngrok/delete
piphp-deploy: ## Deploy piphp
deployment/piphp/deploy
piphp-delete: ## Delete piphp
deployment/piphp/delete
all-deploy: metallb-deploy traefik-deploy httpd-deploy prometheus-deploy grafana-deploy kubewatch-deploy podinfo-deploy ngrok-deploy ## Execute all deployments
all-delete: ngrok-delete podinfo-delete kubewatch-deploy grafana-delete prometheus-delete httpd-delete traefik-delete metallb-delete ## Delete all deployments
setup: thumb-wipe k8s-setup all-deploy ## Setup K8S, deploy all
teardown: all-delete k8s-remove ## Delete all deployments, remove K8S