-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
313 lines (266 loc) · 18.4 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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
### BENCHMARK ###
.PHONY: benchmark-secrets
benchmark-secrets:
mkdir -p k8s/benchmark/secrets/
gopass show -f pluto/gke/benchmark/service-account.json > k8s/benchmark/secrets/service-account.json
kubectl --namespace benchmark create secret generic service-account.json --from-file k8s/benchmark/secrets/service-account.json
.PHONY: benchmark-dsync-dovecot-eu
benchmark-dsync-dovecot-eu:
kubectl apply -f k8s/benchmark/dovecot-users.yml
kubectl delete --ignore-not-found=true -f k8s/benchmark/dovecot-dsync-eu/job.yml
kubectl apply -f k8s/benchmark/dovecot-dsync-eu/config.yml
kubectl apply -f k8s/benchmark/dovecot-dsync-eu/job.yml
.PHONY: benchmark-dsync-dovecot-us
benchmark-dsync-dovecot-us:
kubectl --context="us-east1-b" apply -f k8s/benchmark/dovecot-users.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/benchmark/dovecot-dsync-us/job.yml
kubectl --context="us-east1-b" apply -f k8s/benchmark/dovecot-dsync-us/config.yml
kubectl --context="us-east1-b" apply -f k8s/benchmark/dovecot-dsync-us/job.yml
.PHONY: benchmark-dsync-dovecot-2
benchmark-dsync-dovecot-2:
kubectl --context="us-east1-b" apply -f k8s/benchmark/dovecot-users_us.yml
kubectl --context="europe-west1-b" apply -f k8s/benchmark/dovecot-users_eu.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/benchmark/dovecot-dsync-us/job.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/benchmark/dovecot-dsync-eu/job.yml
kubectl --context="us-east1-b" apply -f k8s/benchmark/dovecot-dsync-us/config.yml
kubectl --context="europe-west1-b" apply -f k8s/benchmark/dovecot-dsync-eu/config.yml
kubectl --context="us-east1-b" apply -f k8s/benchmark/dovecot-dsync-us/job.yml
kubectl --context="europe-west1-b" apply -f k8s/benchmark/dovecot-dsync-eu/job.yml
.PHONY: benchmark-dovecot-simple
benchmark-dovecot-simple:
kubectl apply -f k8s/benchmark/dovecot-users.yml
kubectl delete --ignore-not-found=true -f k8s/benchmark/dovecot-simple/job.yml
kubectl apply -f k8s/benchmark/dovecot-simple/config.yml
kubectl apply -f k8s/benchmark/dovecot-simple/job.yml
.PHONY: benchmark-pluto-simple
benchmark-pluto-simple:
kubectl apply -f k8s/benchmark/pluto-users.yml
kubectl delete --ignore-not-found=true -f k8s/benchmark/pluto-simple/job.yml
kubectl apply -f k8s/benchmark/pluto-simple/config.yml
kubectl apply -f k8s/benchmark/pluto-simple/job.yml
.PHONY: benchmark-pluto-us
benchmark-pluto-us:
kubectl --context="us-east1-b" apply -f k8s/benchmark/pluto-users.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/benchmark/pluto-us/job.yml
kubectl --context="us-east1-b" apply -f k8s/benchmark/pluto-us/config.yml
kubectl --context="us-east1-b" apply -f k8s/benchmark/pluto-us/job.yml
.PHONY: benchmark-pluto-eu
benchmark-pluto-eu:
kubectl --context="europe-west1-b" apply -f k8s/benchmark/pluto-users_eu.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/benchmark/pluto-eu/job.yml
kubectl --context="europe-west1-b" apply -f k8s/benchmark/pluto-eu/config.yml
kubectl --context="europe-west1-b" apply -f k8s/benchmark/pluto-eu/job.yml
.PHONY: benchmark-pluto-2
benchmark-pluto-2:
kubectl --context="us-east1-b" apply -f k8s/benchmark/pluto-users_us.yml
kubectl --context="europe-west1-b" apply -f k8s/benchmark/pluto-users_eu.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/benchmark/pluto-us/job.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/benchmark/pluto-eu/job.yml
kubectl --context="us-east1-b" apply -f k8s/benchmark/pluto-us/config.yml
kubectl --context="europe-west1-b" apply -f k8s/benchmark/pluto-eu/config.yml
kubectl --context="us-east1-b" apply -f k8s/benchmark/pluto-us/job.yml
kubectl --context="europe-west1-b" apply -f k8s/benchmark/pluto-eu/job.yml
### DOVECOT ###
.PHONY: dovecot-stop
dovecot-stop:
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot/backend-1/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot/backend-2/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot/backend-3/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot/proxy/deployment.yml
.PHONY: dovecot-start
dovecot-start:
kubectl --context="europe-west1-b" apply -f k8s/dovecot/backend-1/deployment.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot/backend-2/deployment.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot/backend-3/deployment.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot/proxy/deployment.yml
.PHONY: dovecot-forward
dovecot-forward:
kubectl --namespace dovecot port-forward `kubectl --namespace dovecot get pods | grep proxy | cut -d ' ' -f1` 1993:99
### DOVECOT DSYNC ###
.PHONY: dovecot-dsync-stop
dovecot-dsync-stop:
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-01-eu/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-02-eu/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-03-eu/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/proxy/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-01-eu/pvc.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-02-eu/pvc.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-03-eu/pvc.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-01-us/deployment.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-02-us/deployment.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-03-us/deployment.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/proxy/deployment.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-01-us/pvc.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-02-us/pvc.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/dovecot-dsync/backend-03-us/pvc.yml
.PHONY: dovecot-dsync-start
dovecot-dsync-start:
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/backend-01-eu/dovecot-backend-config.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/backend-02-eu/dovecot-backend-config.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/backend-03-eu/dovecot-backend-config.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/proxy-config.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/proxy-users-eu.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/backend-01-us/dovecot-backend-config.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/backend-02-us/dovecot-backend-config.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/backend-03-us/dovecot-backend-config.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/proxy-config.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/proxy-users-us.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/backend-01-eu/pvc.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/backend-02-eu/pvc.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/backend-03-eu/pvc.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/backend-01-us/pvc.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/backend-02-us/pvc.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/backend-03-us/pvc.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/backend-01-eu/deployment.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/backend-02-eu/deployment.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/backend-03-eu/deployment.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-dsync/proxy/deployment.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/backend-01-us/deployment.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/backend-02-us/deployment.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/backend-03-us/deployment.yml
kubectl --context="us-east1-b" apply -f k8s/dovecot-dsync/proxy/deployment.yml
.PHONY: dovecot-dsync-eu-backend1
dovecot-dsync-eu-backend1:
kubectl --context europe-west1-b --namespace dovecot-dsync exec `kubectl --context europe-west1-b -n dovecot-dsync get pods | grep backend-1 | cut -d ' ' -f1` -c backend-1-eu -i -t bash
.PHONY: dovecot-dsync-eu-backend2
dovecot-dsync-eu-backend2:
kubectl --context europe-west1-b --namespace dovecot-dsync exec `kubectl --context europe-west1-b -n dovecot-dsync get pods | grep backend-2 | cut -d ' ' -f1` -c backend-2-eu -i -t bash
.PHONY: dovecot-dsync-eu-backend3
dovecot-dsync-eu-backend3:
kubectl --context europe-west1-b --namespace dovecot-dsync exec `kubectl --context europe-west1-b -n dovecot-dsync get pods | grep backend-3 | cut -d ' ' -f1` -c backend-3-eu -i -t bash
.PHONY: dovecot-dsync-us-backend1
dovecot-dsync-us-backend1:
kubectl --context us-east1-b --namespace dovecot-dsync exec `kubectl --context us-east1-b -n dovecot-dsync get pods | grep backend-1 | cut -d ' ' -f1` -c backend-1-us -i -t bash
.PHONY: dovecot-dsync-us-backend2
dovecot-dsync-us-backend2:
kubectl --context us-east1-b --namespace dovecot-dsync exec `kubectl --context us-east1-b -n dovecot-dsync get pods | grep backend-2 | cut -d ' ' -f1` -c backend-2-us -i -t bash
.PHONY: dovecot-dsync-us-backend3
dovecot-dsync-us-backend3:
kubectl --context us-east1-b --namespace dovecot-dsync exec `kubectl --context us-east1-b -n dovecot-dsync get pods | grep backend-3 | cut -d ' ' -f1` -c backend-3-us -i -t bash
.PHONY: dsync-secrets
dsync-secrets:
mkdir -p k8s/dovecot-dsync/secrets/
gopass show -f pluto/gke/benchmark/service-account.json > k8s/dovecot-dsync/secrets/service-account.json
kubectl --namespace dovecot-dsync create secret generic service-account.json --from-file k8s/dovecot-dsync/secrets/service-account.json
### DOVECOT SIMPLE ###
.PHONY: dovecot-simple-stop
dovecot-simple-stop:
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-simple/backend-1/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-simple/backend-2/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-simple/backend-3/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-simple/proxy/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-simple/backend-1/pvc.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-simple/backend-2/pvc.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/dovecot-simple/backend-3/pvc.yml
.PHONY: dovecot-simple-start
dovecot-simple-start:
kubectl --context="europe-west1-b" apply -f k8s/dovecot-simple/backend-1/pvc.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-simple/backend-2/pvc.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-simple/backend-3/pvc.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-simple/backend-1/deployment.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-simple/backend-2/deployment.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-simple/backend-3/deployment.yml
kubectl --context="europe-west1-b" apply -f k8s/dovecot-simple/proxy/deployment.yml
.PHONY: dovecot-simple-forward
dovecot-simple-forward:
kubectl --namespace dovecot-simple port-forward `kubectl --namespace dovecot-simple get pods | grep proxy | cut -d ' ' -f1` 1993:993
### MONITORING ###
# Make sure to run prometheus-forward in another terminal
.PHONY: prometheus-configmap
prometheus-configmap:
kubectl apply -f k8s/monitoring/prometheus/configmap.yml
sleep 5
curl -s -i -X POST localhost:9090/-/reload
.PHONY: prometheus-forward
prometheus-forward:
kubectl --context europe-west3-b --namespace monitoring port-forward `kubectl --context europe-west3-b --namespace monitoring get pods | grep prometheus | cut -d ' ' -f1` 9090
.PHONY: grafana-forward
grafana-forward:
kubectl --context europe-west3-b --namespace monitoring port-forward `kubectl --context europe-west3-b --namespace monitoring get pods | grep grafana | cut -d ' ' -f1` 3000
.PHONY: kubectl-proxy
kubectl-proxy:
kubectl --context="europe-west1-b" proxy --port=8080 & kubectl --context="us-east1-b" proxy --port=8081 & kubectl --context="europe-west2-b" proxy --port=8082
### PLUTO ###
.PHONY: pluto-secrets-rm
pluto-secrets-rm:
for name in internal-distributor internal-eu-worker-1 internal-eu-worker-2 internal-eu-worker-3 internal-storage internal-us-worker-1 internal-us-worker-2 internal-us-worker-3 public-distributor root; do \
kubectl --namespace pluto delete secret $$name-cert.pem; \
kubectl --namespace pluto delete secret $$name-key.pem; \
done
.PHONY: pluto-secrets
pluto-secrets:
mkdir -p k8s/pluto/secrets/
for name in internal-distributor internal-eu-worker-1 internal-eu-worker-2 internal-eu-worker-3 internal-storage internal-us-worker-1 internal-us-worker-2 internal-us-worker-3 public-distributor root; do \
gopass show -f pluto/gke/pluto-federation/$$name-cert.pem > k8s/pluto/secrets/$$name-cert.pem; \
gopass show -f pluto/gke/pluto-federation/$$name-key.pem > k8s/pluto/secrets/$$name-key.pem; \
kubectl --namespace pluto create secret generic $$name-cert.pem --from-file k8s/pluto/secrets/$$name-cert.pem; \
kubectl --namespace pluto create secret generic $$name-key.pem --from-file k8s/pluto/secrets/$$name-key.pem; \
done
.PHONY: pluto-stop
pluto-stop:
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/pluto/distributor/deployment-eu.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/pluto/distributor/deployment-us.yml
kubectl delete --ignore-not-found=true -f k8s/pluto/storage/deployment.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/pluto/worker-1/deployment-eu.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/pluto/worker-1/deployment-us.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/pluto/worker-2/deployment-eu.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/pluto/worker-2/deployment-us.yml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/pluto/worker-3/deployment-eu.yml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/pluto/worker-3/deployment-us.yml
kubectl --context="europe-west2-b" delete --ignore-not-found=true -f k8s/pluto/storage/pvc.yaml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/pluto/worker-1/pvc-eu.yaml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/pluto/worker-2/pvc-eu.yaml
kubectl --context="europe-west1-b" delete --ignore-not-found=true -f k8s/pluto/worker-3/pvc-eu.yaml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/pluto/worker-1/pvc-us.yaml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/pluto/worker-2/pvc-us.yaml
kubectl --context="us-east1-b" delete --ignore-not-found=true -f k8s/pluto/worker-3/pvc-us.yaml
.PHONY: pluto-start
pluto-start:
kubectl apply -f k8s/pluto/config-eu.yml
kubectl apply -f k8s/pluto/config-us.yml
kubectl --context="europe-west2-b" apply -f k8s/pluto/storage/pvc.yaml
kubectl --context="europe-west1-b" apply -f k8s/pluto/worker-1/pvc-eu.yaml
kubectl --context="europe-west1-b" apply -f k8s/pluto/worker-2/pvc-eu.yaml
kubectl --context="europe-west1-b" apply -f k8s/pluto/worker-3/pvc-eu.yaml
kubectl --context="us-east1-b" apply -f k8s/pluto/worker-1/pvc-us.yaml
kubectl --context="us-east1-b" apply -f k8s/pluto/worker-2/pvc-us.yaml
kubectl --context="us-east1-b" apply -f k8s/pluto/worker-3/pvc-us.yaml
kubectl --context="europe-west1-b" apply -f k8s/pluto/distributor/deployment-eu.yml
kubectl --context="us-east1-b" apply -f k8s/pluto/distributor/deployment-us.yml
kubectl apply -f k8s/pluto/storage/deployment.yml
kubectl --context="europe-west1-b" apply -f k8s/pluto/worker-1/deployment-eu.yml
kubectl --context="us-east1-b" apply -f k8s/pluto/worker-1/deployment-us.yml
kubectl --context="us-east1-b" apply -f k8s/pluto/worker-2/deployment-us.yml
kubectl --context="europe-west1-b" apply -f k8s/pluto/worker-3/deployment-eu.yml
kubectl --context="us-east1-b" apply -f k8s/pluto/worker-3/deployment-us.yml
kubectl --context="europe-west1-b" apply -f k8s/pluto/worker-2/deployment-eu.yml
.PHONY: pluto-distributor-forward
pluto-distributor-forward:
kubectl --namespace pluto port-forward `kubectl --namespace pluto get pods | grep distributor | cut -d ' ' -f1` 1993
### PLUTO SIMPLE ###
.PHONY: pluto-simple-secrets
pluto-simple-secrets:
mkdir -p k8s/pluto-simple/secrets/
for name in internal-distributor internal-storage internal-worker-1 public-distributor root; do \
gopass show -f pluto/gke/pluto/$$name-cert.pem > k8s/pluto-simple/secrets/$$name-cert.pem; \
gopass show -f pluto/gke/pluto/$$name-key.pem > k8s/pluto-simple/secrets/$$name-key.pem; \
kubectl --namespace pluto-simple create secret generic $$name-cert.pem --from-file k8s/pluto-simple/secrets/$$name-cert.pem; \
kubectl --namespace pluto-simple create secret generic $$name-key.pem --from-file k8s/pluto-simple/secrets/$$name-key.pem; \
done
.PHONY: pluto-simple-stop
pluto-simple-stop:
kubectl delete --ignore-not-found=true -f k8s/pluto-simple/storage/pvc.yml
kubectl delete --ignore-not-found=true -f k8s/pluto-simple/worker-1/pvc.yml
kubectl delete --ignore-not-found=true -f k8s/pluto-simple/distributor/deployment.yml
kubectl delete --ignore-not-found=true -f k8s/pluto-simple/storage/deployment.yml
kubectl delete --ignore-not-found=true -f k8s/pluto-simple/worker-1/deployment.yml
.PHONY: pluto-simple-start
pluto-simple-start:
kubectl apply -f k8s/pluto-simple/storage/pvc.yml
kubectl apply -f k8s/pluto-simple/worker-1/pvc.yml
kubectl apply -f k8s/pluto-simple/distributor/
kubectl apply -f k8s/pluto-simple/storage/
kubectl apply -f k8s/pluto-simple/worker-1/
.PHONY: pluto-simple-distributor-forward
pluto-simple-distributor-forward:
kubectl --namespace pluto-simple port-forward `kubectl --namespace pluto-simple get pods | grep distributor | cut -d ' ' -f1` 1993