forked from replicatedhq/kURL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
379 lines (327 loc) · 13.7 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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
SHELL := /bin/bash
KURL_UTIL_IMAGE ?= replicated/kurl-util:alpha
KURL_BIN_UTILS_FILE ?= kurl-bin-utils-latest.tar.gz
GIT_TREE = $(shell git rev-parse --is-inside-work-tree 2>/dev/null)
ifneq "$(GIT_TREE)" ""
define GIT_UPDATE_INDEX_CMD
git update-index --assume-unchanged
endef
define GIT_SHA
`git rev-parse HEAD`
endef
else
define GIT_UPDATE_INDEX_CMD
echo "Not a git repo, skipping git update-index"
endef
define GIT_SHA
""
endef
endif
.PHONY: clean
clean:
rm -rf build tmp dist
dist/common.tar.gz: build/kustomize build/shared build/krew build/kurlkinds
mkdir -p dist
tar cf dist/common.tar -C build kustomize
tar rf dist/common.tar -C build shared
tar rf dist/common.tar -C build krew
tar rf dist/common.tar -C build kurlkinds
gzip dist/common.tar
dist/kurl-bin-utils-%.tar.gz:
mkdir -p dist
make -C kurl_util build
tar -C ./kurl_util -czvf ./dist/kurl-bin-utils-$*.tar.gz bin
dist/aws-%.tar.gz: build/addons
mkdir -p dist
bin/save-manifest-assets.sh addons/aws/$*/Manifest build/addons/aws/$*
tar cf - -C build addons/aws/$* | gzip > dist/aws-$*.tar.gz
dist/nodeless-%.tar.gz: build/addons
mkdir -p dist
bin/save-manifest-assets.sh addons/nodeless/$*/Manifest $(CURDIR)/build/addons/nodeless/$*
tar cf - -C build addons/nodeless/$* | gzip > dist/nodeless-$*.tar.gz
dist/calico-%.tar.gz: build/addons
mkdir -p dist
bin/save-manifest-assets.sh addons/calico/$*/Manifest $(CURDIR)/build/addons/calico/$*
tar cf - -C build addons/calico/$* | gzip > dist/calico-$*.tar.gz
dist/velero-%.tar.gz: build/addons
mkdir -p build/addons/velero/$*/images
bin/save-manifest-assets.sh addons/velero/$*/Manifest $(CURDIR)/build/addons/velero/$*
mkdir -p dist
tar cf - -C build addons/velero/$* | gzip > dist/velero-$*.tar.gz
dist/openebs-%.tar.gz: build/addons
mkdir -p build/addons/openebs/$*/images
bin/save-manifest-assets.sh addons/openebs/$*/Manifest $(CURDIR)/build/addons/openebs/$*
mkdir -p dist
tar cf - -C build addons/openebs/$* | gzip > dist/openebs-$*.tar.gz
dist/minio-%.tar.gz: build/addons
mkdir -p build/addons/minio/$*/images
bin/save-manifest-assets.sh addons/minio/$*/Manifest $(CURDIR)/build/addons/minio/$*
mkdir -p dist
tar cf - -C build addons/minio/$* | gzip > dist/minio-$*.tar.gz
dist/weave-%.tar.gz: build/addons
mkdir -p build/addons/weave/$*/images
bin/save-manifest-assets.sh addons/weave/$*/Manifest $(CURDIR)/build/addons/weave/$*
mkdir -p dist
tar cf - -C build addons/weave/$* | gzip > dist/weave-$*.tar.gz
dist/rook-%.tar.gz: build/addons
mkdir -p build/addons/rook/$*/images
bin/save-manifest-assets.sh addons/rook/$*/Manifest $(CURDIR)/build/addons/rook/$*
mkdir -p dist
tar cf - -C build addons/rook/$* | gzip > dist/rook-$*.tar.gz
dist/contour-%.tar.gz: build/addons
mkdir -p build/addons/contour/$*/images
bin/save-manifest-assets.sh addons/contour/$*/Manifest $(CURDIR)/build/addons/contour/$*
mkdir -p dist
tar cf - -C build addons/contour/$* | gzip > dist/contour-$*.tar.gz
dist/registry-%.tar.gz: build/addons
mkdir -p build/addons/registry/$*/images
bin/save-manifest-assets.sh addons/registry/$*/Manifest $(CURDIR)/build/addons/registry/$*
mkdir -p dist
tar cf - -C build addons/registry/$* | gzip > dist/registry-$*.tar.gz
dist/prometheus-%.tar.gz: build/addons
mkdir -p build/addons/prometheus/$*/images
bin/save-manifest-assets.sh addons/prometheus/$*/Manifest $(CURDIR)/build/addons/prometheus/$*
mkdir -p dist
tar cf - -C build addons/prometheus/$* | gzip > dist/prometheus-$*.tar.gz
dist/fluentd-%.tar.gz: build/addons
mkdir -p build/addons/fluentd/$*/images
bin/save-manifest-assets.sh addons/fluentd/$*/Manifest $(CURDIR)/build/addons/fluentd/$*
mkdir -p dist
tar cf - -C build addons/fluentd/$* | gzip > dist/fluentd-$*.tar.gz
dist/ekco-%.tar.gz: build/addons
mkdir -p build/addons/ekco/$*/images
bin/save-manifest-assets.sh addons/ekco/$*/Manifest build/addons/ekco/$*
mkdir -p dist
tar cf - -C build addons/ekco/$* | gzip > dist/ekco-$*.tar.gz
dist/kotsadm-%.tar.gz: build/addons
mkdir -p build/addons/kotsadm/$*/images
bin/save-manifest-assets.sh addons/kotsadm/$*/Manifest $(CURDIR)/build/addons/kotsadm/$*
mkdir -p dist
tar cf - -C build addons/kotsadm/$* | gzip > dist/kotsadm-$*.tar.gz
dist/docker-%.tar.gz:
${MAKE} build/packages/docker/$*/ubuntu-16.04
${MAKE} build/packages/docker/$*/ubuntu-18.04
${MAKE} build/packages/docker/$*/ubuntu-20.04
${MAKE} build/packages/docker/$*/rhel-7
mkdir -p dist
tar cf - -C build packages/docker/$* | gzip > dist/docker-$*.tar.gz
dist/containerd-%.tar.gz: build/addons
mkdir -p build/addons/containerd/$*/assets
bin/save-manifest-assets.sh addons/containerd/$*/Manifest $(CURDIR)/build/addons/containerd/$*
mkdir -p dist
tar cf - -C build addons/containerd/$* | gzip > dist/containerd-$*.tar.gz
dist/kubernetes-%.tar.gz:
${MAKE} build/packages/kubernetes/$*/images
${MAKE} build/packages/kubernetes/$*/ubuntu-16.04
${MAKE} build/packages/kubernetes/$*/ubuntu-18.04
${MAKE} build/packages/kubernetes/$*/ubuntu-20.04
${MAKE} build/packages/kubernetes/$*/rhel-7
${MAKE} build/packages/kubernetes/$*/rhel-8
cp packages/kubernetes/$*/Manifest build/packages/kubernetes/$*/
mkdir -p dist
tar cf - -C build packages/kubernetes/$* | gzip > dist/kubernetes-$*.tar.gz
build/packages/kubernetes/%/images:
mkdir -p build/packages/kubernetes/$*/images
bin/save-manifest-assets.sh packages/kubernetes/$*/Manifest build/packages/kubernetes/$*
build/install.sh:
mkdir -p tmp build
sed '/# Magic begin/q' scripts/install.sh | sed '$$d' > tmp/install.sh
for script in $(shell cat scripts/install.sh | grep '\. $$DIR/' | sed 's/. $$DIR\///'); do \
cat $$script >> tmp/install.sh ; \
done
sed -n '/# Magic end/,$$p' scripts/install.sh | sed '1d' >> tmp/install.sh
mv tmp/install.sh build/install.sh
chmod +x build/install.sh
build/templates/install.tmpl: build/install.sh
mkdir -p build/templates
sed 's/^KURL_URL=.*/KURL_URL="{{= KURL_URL }}"/' "build/install.sh" | \
sed 's/^DIST_URL=.*/DIST_URL="{{= DIST_URL }}"/' | \
sed 's/^INSTALLER_ID=.*/INSTALLER_ID="{{= INSTALLER_ID }}"/' | \
sed 's/^REPLICATED_APP_URL=.*/REPLICATED_APP_URL="{{= REPLICATED_APP_URL }}"/' | \
sed 's/^STEP_VERSIONS=.*/STEP_VERSIONS={{= STEP_VERSIONS }}/' | \
sed 's/^INSTALLER_YAML=.*/INSTALLER_YAML="{{= INSTALLER_YAML }}"/' | \
sed 's/^KURL_UTIL_IMAGE=.*/KURL_UTIL_IMAGE="{{= KURL_UTIL_IMAGE }}"/' | \
sed 's/^KURL_BIN_UTILS_FILE=.*/KURL_BIN_UTILS_FILE="{{= KURL_BIN_UTILS_FILE }}"/' \
> build/templates/install.tmpl
build/join.sh:
mkdir -p tmp build
sed '/# Magic begin/q' scripts/join.sh | sed '$$d' > tmp/join.sh
for script in $(shell cat scripts/join.sh | grep '\. $$DIR/' | sed 's/. $$DIR\///'); do \
cat $$script >> tmp/join.sh ; \
done
sed -n '/# Magic end/,$$p' scripts/join.sh | sed '1d' >> tmp/join.sh
mv tmp/join.sh build/join.sh
chmod +x build/join.sh
build/templates/join.tmpl: build/join.sh
mkdir -p build/templates
sed 's/^KURL_URL=.*/KURL_URL="{{= KURL_URL }}"/' "build/join.sh" | \
sed 's/^DIST_URL=.*/DIST_URL="{{= DIST_URL }}"/' | \
sed 's/^INSTALLER_ID=.*/INSTALLER_ID="{{= INSTALLER_ID }}"/' | \
sed 's/^REPLICATED_APP_URL=.*/REPLICATED_APP_URL="{{= REPLICATED_APP_URL }}"/' | \
sed 's/^STEP_VERSIONS=.*/STEP_VERSIONS={{= STEP_VERSIONS }}/' | \
sed 's/^INSTALLER_YAML=.*/INSTALLER_YAML="{{= INSTALLER_YAML }}"/' | \
sed 's/^KURL_UTIL_IMAGE=.*/KURL_UTIL_IMAGE="{{= KURL_UTIL_IMAGE }}"/' | \
sed 's/^KURL_BIN_UTILS_FILE=.*/KURL_BIN_UTILS_FILE="{{= KURL_BIN_UTILS_FILE }}"/' \
> build/templates/join.tmpl
build/upgrade.sh:
mkdir -p tmp build
sed '/# Magic begin/q' scripts/upgrade.sh | sed '$$d' > tmp/upgrade.sh
for script in $(shell cat scripts/upgrade.sh | grep '\. $$DIR/' | sed 's/. $$DIR\///'); do \
cat $$script >> tmp/upgrade.sh ; \
done
sed -n '/# Magic end/,$$p' scripts/upgrade.sh | sed '1d' >> tmp/upgrade.sh
mv tmp/upgrade.sh build/upgrade.sh
chmod +x ./build/upgrade.sh
build/templates/upgrade.tmpl: build/upgrade.sh
mkdir -p build/templates
sed 's/^KURL_URL=.*/KURL_URL="{{= KURL_URL }}"/' "build/upgrade.sh" | \
sed 's/^DIST_URL=.*/DIST_URL="{{= DIST_URL }}"/' | \
sed 's/^INSTALLER_ID=.*/INSTALLER_ID="{{= INSTALLER_ID }}"/' | \
sed 's/^REPLICATED_APP_URL=.*/REPLICATED_APP_URL="{{= REPLICATED_APP_URL }}"/' | \
sed 's/^STEP_VERSIONS=.*/STEP_VERSIONS={{= STEP_VERSIONS }}/' | \
sed 's/^INSTALLER_YAML=.*/INSTALLER_YAML="{{= INSTALLER_YAML }}"/' | \
sed 's/^KURL_UTIL_IMAGE=.*/KURL_UTIL_IMAGE="{{= KURL_UTIL_IMAGE }}"/' | \
sed 's/^KURL_BIN_UTILS_FILE=.*/KURL_BIN_UTILS_FILE="{{= KURL_BIN_UTILS_FILE }}"/' \
> build/templates/upgrade.tmpl
build/tasks.sh:
mkdir -p tmp build
sed '/# Magic begin/q' scripts/tasks.sh | sed '$$d' > tmp/tasks.sh
for script in $(shell cat scripts/tasks.sh | grep '\. $$DIR/' | sed 's/. $$DIR\///'); do \
cat $$script >> tmp/tasks.sh ; \
done
sed -n '/# Magic end/,$$p' scripts/tasks.sh | sed '1d' >> tmp/tasks.sh
mv tmp/tasks.sh build/tasks.sh
chmod +x build/tasks.sh
build/templates/tasks.tmpl: build/tasks.sh
mkdir -p build/templates
cp build/tasks.sh build/templates/tasks.tmpl
build/addons:
mkdir -p build
cp -r addons build/
build/krew:
mkdir -p build/krew
docker build -t krew -f bundles/krew/Dockerfile bundles/krew
- docker rm -f krew 2>/dev/null
docker create --name krew krew:latest
docker cp krew:/krew build/
docker rm krew
build/kurlkinds:
mkdir -p build/kurlkinds
cp kurlkinds/config/crds/v1beta1/cluster.kurl.sh_installers.yaml build/kurlkinds
build/kustomize:
mkdir -p build
cp -r scripts/kustomize build/
build/shared: kurl-util-image
mkdir -p build/shared
docker save $(KURL_UTIL_IMAGE) > build/shared/kurl-util.tar
build/packages/docker/%/ubuntu-16.04:
docker build \
--build-arg DOCKER_VERSION=$* \
-t kurl/ubuntu-1604-docker:$* \
-f bundles/docker-ubuntu1604/Dockerfile \
bundles/docker-ubuntu1604
-docker rm -f docker-ubuntu1604-$* 2>/dev/null
docker create --name docker-ubuntu1604-$* kurl/ubuntu-1604-docker:$*
mkdir -p build/packages/docker/$*/ubuntu-16.04
docker cp docker-ubuntu1604-$*:/packages/archives/. build/packages/docker/$*/ubuntu-16.04
docker rm docker-ubuntu1604-$*
build/packages/docker/%/ubuntu-18.04:
docker build \
--build-arg DOCKER_VERSION=$* \
-t kurl/ubuntu-1804-docker:$* \
-f bundles/docker-ubuntu1804/Dockerfile \
bundles/docker-ubuntu1804
-docker rm -f docker-ubuntu1804-$* 2>/dev/null
docker create --name docker-ubuntu1804-$* kurl/ubuntu-1804-docker:$*
mkdir -p build/packages/docker/$*/ubuntu-18.04
docker cp docker-ubuntu1804-$*:/packages/archives/. build/packages/docker/$*/ubuntu-18.04
docker rm docker-ubuntu1804-$*
build/packages/docker/%/ubuntu-20.04:
./bundles/docker-ubuntu2004/build.sh $* `pwd`/build/packages/docker/$*/ubuntu-20.04
build/packages/docker/%/rhel-7:
docker build \
--build-arg DOCKER_VERSION=$* \
-t kurl/rhel-7-docker:$* \
-f bundles/docker-rhel7/Dockerfile \
bundles/docker-rhel7
-docker rm -f docker-rhel7 2>/dev/null
docker create --name docker-rhel7-$* kurl/rhel-7-docker:$*
mkdir -p build/packages/docker/$*/rhel-7
docker cp docker-rhel7-$*:/packages/archives/. build/packages/docker/$*/rhel-7
docker rm docker-rhel7-$*
build/packages/kubernetes/%/ubuntu-16.04:
docker build \
--build-arg KUBERNETES_VERSION=$* \
-t kurl/ubuntu-1604-k8s:$* \
-f bundles/k8s-ubuntu1604/Dockerfile \
bundles/k8s-ubuntu1604
-docker rm -f k8s-ubuntu1604-$* 2>/dev/null
docker create --name k8s-ubuntu1604-$* kurl/ubuntu-1604-k8s:$*
mkdir -p build/packages/kubernetes/$*/ubuntu-16.04
docker cp k8s-ubuntu1604-$*:/packages/archives/. build/packages/kubernetes/$*/ubuntu-16.04/
docker rm k8s-ubuntu1604-$*
build/packages/kubernetes/%/ubuntu-18.04:
docker build \
--build-arg KUBERNETES_VERSION=$* \
-t kurl/ubuntu-1804-k8s:$* \
-f bundles/k8s-ubuntu1804/Dockerfile \
bundles/k8s-ubuntu1804
-docker rm -f k8s-ubuntu1804-$* 2>/dev/null
docker create --name k8s-ubuntu1804-$* kurl/ubuntu-1804-k8s:$*
mkdir -p build/packages/kubernetes/$*/ubuntu-18.04
docker cp k8s-ubuntu1804-$*:/packages/archives/. build/packages/kubernetes/$*/ubuntu-18.04/
docker rm k8s-ubuntu1804-$*
build/packages/kubernetes/%/ubuntu-20.04:
docker build \
--build-arg KUBERNETES_VERSION=$* \
-t kurl/ubuntu-2004-k8s:$* \
-f bundles/k8s-ubuntu2004/Dockerfile \
bundles/k8s-ubuntu2004
-docker rm -f k8s-ubuntu2004-$* 2>/dev/null
docker create --name k8s-ubuntu2004-$* kurl/ubuntu-2004-k8s:$*
mkdir -p build/packages/kubernetes/$*/ubuntu-20.04
docker cp k8s-ubuntu2004-$*:/packages/archives/. build/packages/kubernetes/$*/ubuntu-20.04/
docker rm k8s-ubuntu2004-$*
build/packages/kubernetes/%/rhel-7:
docker build \
--build-arg KUBERNETES_VERSION=$* \
-t kurl/rhel-7-k8s:$* \
-f bundles/k8s-rhel7/Dockerfile \
bundles/k8s-rhel7
-docker rm -f k8s-rhel7-$* 2>/dev/null
docker create --name k8s-rhel7-$* kurl/rhel-7-k8s:$*
mkdir -p build/packages/kubernetes/$*/rhel-7
docker cp k8s-rhel7-$*:/packages/archives/. build/packages/kubernetes/$*/rhel-7/
docker rm k8s-rhel7-$*
build/packages/kubernetes/%/rhel-8:
docker build \
--build-arg KUBERNETES_VERSION=$* \
-t kurl/rhel-8-k8s:$* \
-f bundles/k8s-rhel8/Dockerfile \
bundles/k8s-rhel8
-docker rm -f k8s-rhel8-$* 2>/dev/null
docker create --name k8s-rhel8-$* kurl/rhel-8-k8s:$*
mkdir -p build/packages/kubernetes/$*/rhel-8
docker cp k8s-rhel8-$*:/packages/archives/. build/packages/kubernetes/$*/rhel-8/
docker rm k8s-rhel8-$*
build/templates: build/templates/install.tmpl build/templates/join.tmpl build/templates/upgrade.tmpl build/templates/tasks.tmpl
build/bin:
${MAKE} -C kurl_util build
cp -r kurl_util/bin build
.PHONY: code
code: build/templates build/kustomize build/addons
build/bin/server:
go build -o build/bin/server cmd/server/main.go
.PHONY: web
web: build/templates build/bin/server
mkdir -p web/build
cp -r build/templates web
cp -r build/bin web
watchrsync:
bin/watchrsync.js
.PHONY: kurl-util-image
kurl-util-image:
docker pull $(KURL_UTIL_IMAGE)
.PHONY: generate-addons
generate-addons:
node generate-addons.js