-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
322 lines (264 loc) · 12.5 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
314
315
316
317
318
319
320
321
322
IMAGE="helmunittest/helm-unittest:3.11.1-0.3.0"
# requires --user in the docker call to allow writing in the user's home
UID=1000
# This allows to introspect the swh/tests/__snapshot__/<generated-chart>.yaml
# output of the chart execution in the test context. It's in a dedicated
# target as this generates temporary files. This is to be used exceptionally
# to ease troubleshooting
ACTIVATE_SNAPSHOT=--update-snapshot
SWH_CHART=swh
CC_CHART=cluster-components
CCF_CHART=cluster-configuration
SS_CHART=software-stories
DIFF_COMMAND=auto
SECRET_FILES='$(SWH_CHART)/fake-secrets'
# For sandboxed environment
LOCAL_CLUSTER_ENVIRONMENT=kind
LOCAL_CLUSTER_CONTEXT=kind-local-cluster
# You can chose to use minikube
# LOCAL_CLUSTER_ENVIRONMENT=minikube
# LOCAL_CLUSTER_CONTEXT=$(LOCAL_CLUSTER_ENVIRONMENT)
# (deprecated) Retro-compatible name
MINIKUBE_CONTEXT=$(LOCAL_CLUSTER_CONTEXT)
CC_LOCAL_OVERRIDE=local-cluster-cc.override.yaml
SWH_LOCAL_OVERRIDE=local-cluster-swh.override.yaml
CCF_LOCAL_OVERRIDE=local-cluster-ccf.override.yaml
ifeq (,$(wildcard $(CCF_LOCAL_OVERRIDE)))
CCF_VALUES_OVERRIDE := --debug
else
CCF_VALUES_OVERRIDE := --values $(CCF_LOCAL_OVERRIDE)
endif
ifeq (,$(wildcard $(CC_LOCAL_OVERRIDE)))
CC_VALUES_OVERRIDE := --debug
else
CC_VALUES_OVERRIDE := --values $(CC_LOCAL_OVERRIDE)
endif
ifeq (,$(wildcard $(SWH_LOCAL_OVERRIDE)))
SWH_VALUES_OVERRIDE := --debug
else
SWH_VALUES_OVERRIDE := --values $(SWH_LOCAL_OVERRIDE)
endif
# use: make VERBOSE=1 to actually have the command displayed
ifndef VERBOSE
.SILENT:
endif
-include Makefile.local
local-cluster-create:
bin/local-cluster.sh create $(LOCAL_CLUSTER_CONTEXT) $(LOCAL_CLUSTER_ENVIRONMENT)
local-cluster-install-deps:
bin/local-cluster.sh install-deps $(LOCAL_CLUSTER_CONTEXT) $(LOCAL_CLUSTER_ENVIRONMENT)
local-cluster-restart:
bin/local-cluster.sh restart $(LOCAL_CLUSTER_CONTEXT)
local-cluster-cleanup-deps:
bin/local-cluster.sh cleanup-deps $(LOCAL_CLUSTER_CONTEXT)
local-cluster-pause:
bin/local-cluster.sh pause $(LOCAL_CLUSTER_CONTEXT) $(LOCAL_CLUSTER_ENVIRONMENT)
local-cluster-unpause:
bin/local-cluster.sh unpause $(LOCAL_CLUSTER_CONTEXT) $(LOCAL_CLUSTER_ENVIRONMENT)
local-cluster-delete:
bin/local-cluster.sh delete $(LOCAL_CLUSTER_CONTEXT)
swh-test:
docker run -ti --user $(UID) --rm -v $(PWD):/apps \
$(IMAGE) swh
swh-test-with-snapshot:
docker run -ti --user $(UID) --rm -v $(PWD):/apps \
$(IMAGE) $(ACTIVATE_SNAPSHOT) swh
ss-test:
docker run -ti --user $(UID) --rm -v $(PWD):/apps \
$(IMAGE) software-stories
ss-test-with-snapshot:
docker run -ti --user $(UID) --rm -v $(PWD):/apps \
$(IMAGE) $(ACTIVATE_SNAPSHOT) software-stories
swh-helm-diff:
./swh/helm-diff.sh production $(DIFF_COMMAND)
ccf-helm-diff:
./helm-diff.sh $(CCF_CHART) $(DIFF_COMMAND)
cc-helm-diff:
./helm-diff.sh $(CC_CHART) $(DIFF_COMMAND)
ss-helm-diff:
./helm-diff.sh $(SS_CHART) $(DIFF_COMMAND)
helm-diff: swh-helm-diff ccf-helm-diff cc-helm-diff ss-helm-diff
local-cluster-swh-prepare:
kubectl --context $(LOCAL_CLUSTER_CONTEXT) get namespace swh 2>&1 >/dev/null || \
kubectl --context $(LOCAL_CLUSTER_CONTEXT) create namespace swh
local-cluster-swh-prepare-secrets:
cat $(SECRET_FILES)/*.yaml | kubectl --context $(LOCAL_CLUSTER_CONTEXT) \
--namespace swh apply -f -
swh-minikube: swh-local-cluster
local-cluster-swh: swh-local-cluster
swh-local-cluster: local-cluster-swh-prepare local-cluster-swh-prepare-secrets
helm --kube-context $(LOCAL_CLUSTER_CONTEXT) upgrade --install $(SWH_CHART) $(SWH_CHART) \
--values values-swh-application-versions.yaml \
--values $(SWH_CHART)/values.yaml \
--values $(SWH_CHART)/values/local-cluster.yaml \
$(SWH_VALUES_OVERRIDE) \
-n swh --debug
swh-uninstall: swh-local-cluster-uninstall
local-cluster-uninstall-swh: swh-local-cluster-uninstall
swh-local-cluster-uninstall:
helm --kube-context $(LOCAL_CLUSTER_CONTEXT) uninstall $(SWH_CHART) -n swh ; \
kubectl --context $(LOCAL_CLUSTER_CONTEXT) --namespace swh delete -f '$(SWH_CHART)/fake-secrets/*.yaml'; \
kubectl --context $(LOCAL_CLUSTER_CONTEXT) delete namespace swh
swh-template:
helm template template-$(SWH_CHART) $(SWH_CHART)/ --values values-swh-application-versions.yaml \
--values $(SWH_CHART)/values.yaml \
--values $(SWH_CHART)/values/local-cluster.yaml \
$(SWH_VALUES_OVERRIDE) \
-n swh --create-namespace --debug
swh-template-staging:
helm template template-$(SWH_CHART) $(SWH_CHART)/ --values values-swh-application-versions.yaml \
--values $(SWH_CHART)/values.yaml \
--values $(SWH_CHART)/values/default.yaml \
--values $(SWH_CHART)/values/staging/default.yaml \
--values $(SWH_CHART)/values/staging/swh.yaml \
-n swh --create-namespace --debug
swh-template-staging-cassandra:
helm template template-$(SWH_CHART) $(SWH_CHART)/ --values values-swh-application-versions.yaml \
--values $(SWH_CHART)/values.yaml \
--values $(SWH_CHART)/values/default.yaml \
--values $(SWH_CHART)/values/staging/default.yaml \
--values $(SWH_CHART)/values/staging/swh-cassandra.yaml \
-n swh --create-namespace --debug
swh-template-staging-cassandra-next-version:
helm template template-$(SWH_CHART) $(SWH_CHART)/ --values values-swh-application-versions.yaml \
--values $(SWH_CHART)/values.yaml \
--values $(SWH_CHART)/values/default.yaml \
--values $(SWH_CHART)/values/staging/default.yaml \
--values $(SWH_CHART)/values/staging/swh-cassandra.yaml \
--values $(SWH_CHART)/values/staging/overrides/swh-cassandra-next-version.yaml \
-n swh --create-namespace --debug
swh-template-production:
helm template template-$(SWH_CHART) $(SWH_CHART)/ --values values-swh-application-versions.yaml \
--values $(SWH_CHART)/values.yaml \
--values $(SWH_CHART)/values/default.yaml \
--values $(SWH_CHART)/values/production/default.yaml \
--values $(SWH_CHART)/values/production/swh.yaml \
-n swh --create-namespace --debug
swh-template-production-cassandra:
helm template template-$(SWH_CHART) $(SWH_CHART)/ --values values-swh-application-versions.yaml \
--values $(SWH_CHART)/values.yaml \
--values $(SWH_CHART)/values/default.yaml \
--values $(SWH_CHART)/values/production/default.yaml \
--values $(SWH_CHART)/values/production/swh-cassandra.yaml \
-n swh --create-namespace --debug
local-cluster-cc-prepare:
kubectl --context $(LOCAL_CLUSTER_CONTEXT) get namespace cluster-components 2>&1 >/dev/null || \
kubectl --context $(LOCAL_CLUSTER_CONTEXT) create namespace cluster-components
local-cluster-cc-prepare-secrets:
cat $(SECRET_FILES)/*.yaml | kubectl --context $(LOCAL_CLUSTER_CONTEXT) \
--namespace cluster-components apply -f -
cc-minikube: cc-local-cluster
local-cluster-cc: cc-local-cluster
cc-local-cluster: local-cluster-cc-prepare local-cluster-swh-prepare local-cluster-cc-prepare-secrets local-cluster-swh-prepare-secrets
helm --kube-context $(LOCAL_CLUSTER_CONTEXT) upgrade --install $(CC_CHART) $(CC_CHART)/ \
--values values-swh-application-versions.yaml \
--values $(CC_CHART)/values.yaml \
--values $(CC_CHART)/values/local-cluster.yaml \
$(CC_VALUES_OVERRIDE) \
--namespace cluster-components --create-namespace --debug
cc-uninstall: cc-local-cluster-uninstall
local-cluster-uninstall-cc: cc-local-cluster-uninstall
cc-local-cluster-uninstall:
helm --kube-context $(LOCAL_CLUSTER_CONTEXT) uninstall $(CC_CHART) --namespace cluster-components; \
kubectl --context $(LOCAL_CLUSTER_CONTEXT) --namespace cluster-components delete -f '$(SWH_CHART)/fake-secrets/*.yaml'; \
kubectl --context $(LOCAL_CLUSTER_CONTEXT) delete namespace cluster-components
cc-template:
helm template template-$(CC_CHART) $(CC_CHART)/ --values values-swh-application-versions.yaml \
--values $(CC_CHART)/values.yaml \
--values $(CC_CHART)/values/local-cluster.yaml \
$(CC_VALUES_OVERRIDE) \
--namespace cluster-components --create-namespace --debug
cc-template-test-staging-rke2:
helm template template-$(CC_CHART) $(CC_CHART)/ --values values-swh-application-versions.yaml \
--values $(CC_CHART)/values.yaml \
--values $(CC_CHART)/values/default.yaml \
--values $(CC_CHART)/values/test-staging-rke2.yaml \
--debug
cc-template-staging:
helm template template-$(CC_CHART) $(CC_CHART)/ --values values-swh-application-versions.yaml \
--values $(CC_CHART)/values.yaml \
--values $(CC_CHART)/values/default.yaml \
--values $(CC_CHART)/values/archive-staging-rke2.yaml \
--debug
cc-template-staging-next-version:
helm template template-$(CC_CHART) $(CC_CHART)/ --values values-swh-application-versions.yaml \
--values $(CC_CHART)/values.yaml \
--values $(CC_CHART)/values/default.yaml \
--values $(CC_CHART)/values/archive-staging-rke2-next-version.yaml \
--debug
cc-template-production:
helm template template-$(CC_CHART) $(CC_CHART)/ --values values-swh-application-versions.yaml \
--values $(CC_CHART)/values.yaml \
--values $(CC_CHART)/values/default.yaml \
--values $(CC_CHART)/values/archive-production-rke2.yaml \
--debug
cc-template-admin:
helm template template-$(CC_CHART) $(CC_CHART)/ --values values-swh-application-versions.yaml \
--values $(CC_CHART)/values.yaml \
--values $(CC_CHART)/values/default.yaml \
--values $(CC_CHART)/values/admin-rke2.yaml \
--debug
ccf-template:
helm template template-$(CCF_CHART) $(CCF_CHART)/ --values values-swh-application-versions.yaml \
--values $(CCF_CHART)/values.yaml \
--values $(CCF_CHART)/values/local-cluster.yaml \
$(CCF_VALUES_OVERRIDE) \
--debug
ccf-template-admin-rke2:
helm template template-$(CCF_CHART) $(CCF_CHART)/ --values values-swh-application-versions.yaml \
--values $(CCF_CHART)/values.yaml \
--values $(CCF_CHART)/values/admin-rke2.yaml \
-n default --create-namespace --debug
ccf-template-archive-production-rke2:
helm template template-$(CCF_CHART) $(CCF_CHART)/ --values values-swh-application-versions.yaml \
--values $(CCF_CHART)/values.yaml \
--values $(CCF_CHART)/values/archive-production-rke2.yaml \
--debug
ccf-template-archive-staging-rke2:
helm template template-$(CCF_CHART) $(CCF_CHART)/ --values values-swh-application-versions.yaml \
--values $(CCF_CHART)/values.yaml \
--values $(CCF_CHART)/values/archive-staging-rke2.yaml \
--debug
ccf-template-gitlab-production:
helm template template-$(CCF_CHART) $(CCF_CHART)/ --values values-swh-application-versions.yaml \
--values $(CCF_CHART)/values.yaml \
--values $(CCF_CHART)/values/gitlab-production.yaml \
--debug
ccf-template-gitlab-staging:
helm template template-$(CCF_CHART) $(CCF_CHART)/ --values values-swh-application-versions.yaml \
--values $(CCF_CHART)/values.yaml \
--values $(CCF_CHART)/values/gitlab-staging.yaml \
--debug
ccf-template-rancher:
helm template template-$(CCF_CHART) $(CCF_CHART)/ --values values-swh-application-versions.yaml \
--values $(CCF_CHART)/values.yaml \
--values $(CCF_CHART)/values/rancher.yaml \
--debug
ccf-template-test-staging-rke2:
helm template template-$(CCF_CHART) $(CCF_CHART)/ --values values-swh-application-versions.yaml \
--values $(CCF_CHART)/values.yaml \
--values $(CCF_CHART)/values/test-staging-rke2.yaml \
--debug
ss-minikube: ss-local-cluster
ss-local-cluster:
helm --kube-context $(LOCAL_CLUSTER_CONTEXT) upgrade --install $(SS_CHART) $(SS_CHART)/ --values values-swh-application-versions.yaml \
--values $(SS_CHART)/values.yaml \
--values $(SS_CHART)/values/local-cluster.yaml \
-n software-stories --create-namespace --debug
ss-uninstall: ss-local-cluster-uninstall
local-cluster-uninstall-ss: ss-local-cluster-uninstall
ss-local-cluster-uninstall:
helm --kube-context $(LOCAL_CLUSTER_CONTEXT) uninstall $(SS_CHART) -n software-stories
ss-template:
helm template template-$(SS_CHART) $(SS_CHART)/ --values values-swh-application-versions.yaml \
--values $(SS_CHART)/values.yaml \
--values $(SS_CHART)/values/local-cluster.yaml \
-n software-stories --create-namespace --debug
ss-template-staging:
helm template template-$(SS_CHART) $(SS_CHART)/ --values values-swh-application-versions.yaml \
--values $(SS_CHART)/values.yaml \
--values $(SS_CHART)/values/staging.yaml
ss-template-production:
helm template template-$(SS_CHART) $(SS_CHART)/ --values values-swh-application-versions.yaml \
--values $(SS_CHART)/values.yaml \
--values $(SS_CHART)/values/production.yaml