-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathMakefile
More file actions
133 lines (107 loc) · 5.28 KB
/
Makefile
File metadata and controls
133 lines (107 loc) · 5.28 KB
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
SHELL = bash
PKG_VERSION ?= v1.5.0
OCI_DRIVER_VERSION ?= v1.34.0
PRE_COMMIT := $(shell command -v pre-commit 2> /dev/null)
PODMAN := $(shell command -v podman 2> /dev/null)
OC := $(shell command -v oc 2> /dev/null)
.PHONY: all
all: precommit machineconfigs manifests version checksums zip
.PHONY: precommit
precommit:
ifdef PRE_COMMIT
$(info Running pre-commit...)
pre-commit run --all-files
else
$(warning pre-commit not installed. Skipping...)
endif
.PHONY: zip
zip:
$(info Zipping all terraform-stacks...)
@if [ ! -d dist ]; then \
mkdir dist ; \
fi
@cd terraform-stacks ; \
for stack in * ; do \
if [ -d $$stack ] && [ "$$stack" != "shared_modules" ]; then \
cd $$stack ; \
zip -FS -r -q ../../dist/$$stack-${PKG_VERSION}.zip * -x **/.terraform/\* -x \.* ; \
zip -FS -r -q ../../dist/$$stack.zip * -x **/.terraform/\* -x \.* ; \
cd .. ; \
fi ; \
done
.PHONY: manifests
manifests:
$(info Creating condensed-manifest.yml...)
@cat ./custom_manifests/manifests/* > custom_manifests/condensed-manifest.yml ; \
.PHONY: machineconfigs
machineconfigs:
ifdef PODMAN
$(info Generating MachineConfigs from Butane...)
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-kubelet-providerid-master.bu > custom_manifests/manifests/02-machineconfig-ccm.yml
@echo '---' >> custom_manifests/manifests/02-machineconfig-ccm.yml
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-kubelet-providerid-worker.bu >> custom_manifests/manifests/02-machineconfig-ccm.yml
@echo '---' >> custom_manifests/manifests/02-machineconfig-ccm.yml
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/iscsid-master.bu > custom_manifests/manifests/02-machineconfig-csi.yml
@echo '---' >> custom_manifests/manifests/02-machineconfig-csi.yml
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/iscsid-worker.bu >> custom_manifests/manifests/02-machineconfig-csi.yml
@echo '---' >> custom_manifests/manifests/02-machineconfig-csi.yml
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-add-consistent-device-path-master.bu > custom_manifests/manifests/03-machineconfig-consistent-device-path.yml
@echo '---' >> custom_manifests/manifests/03-machineconfig-consistent-device-path.yml
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-add-consistent-device-path-worker.bu >> custom_manifests/manifests/03-machineconfig-consistent-device-path.yml
@echo '---' >> custom_manifests/manifests/03-machineconfig-consistent-device-path.yml
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-eval-user-data-master.bu > custom_manifests/manifests/05-oci-eval-user-data.yml
@echo '---' >> custom_manifests/manifests/05-oci-eval-user-data.yml
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/oci-eval-user-data-worker.bu >> custom_manifests/manifests/05-oci-eval-user-data.yml
@echo '---' >> custom_manifests/manifests/05-oci-eval-user-data.yml
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/vlan-bm-mtu-configure-master.bu > custom_manifests/manifests/07-configure-bm-vlan-mtu.yml
@echo '---' >> custom_manifests/manifests/07-configure-bm-vlan-mtu.yml
@podman run -i --rm quay.io/coreos/butane:release --pretty --strict < custom_manifests/butane/vlan-bm-mtu-configure-worker.bu >> custom_manifests/manifests/07-configure-bm-vlan-mtu.yml
@echo '---' >> custom_manifests/manifests/07-configure-bm-vlan-mtu.yml
else
$(warning podman not installed. Skipping...)
endif
# generate individual file checksums and zipped stack checksums
.PHONY: checksums
checksums:
$(info Writing checksums...)
@if [ ! -d checksums ]; then \
mkdir checksums ; \
fi
@find ./custom_manifests -type f -name '*.yml' -print0 | sort -z | xargs -0 shasum -a 256 > checksums/custom_manifests.SHA256SUMS
@find ./terraform-stacks -type f -name '*.tf' -print0 | sort -z | xargs -0 shasum -a 256 > checksums/terraform-stacks.SHA256SUMS
@cd terraform-stacks ; \
for stack in * ; do \
if [ -d $$stack ] && [ "$$stack" != "shared_modules" ]; then \
cd $$stack ; \
find . -type f -name '*.tf' -print0 | sort -z | xargs -0 shasum -a 256 > $$stack.SHA256SUMS ; \
cd .. ; \
fi ; \
done
.PHONY: version
version:
$(info Using PKG_VERSION=$(PKG_VERSION)...)
@cd terraform-stacks ; \
for stack in * ; do \
if [ -d $$stack ] && [ "$$stack" != "shared_modules" ]; then \
cd $$stack ; \
printf "locals {\n stack_version = \"${PKG_VERSION}\"\n}\n" > version.tf ; \
cd .. ; \
fi ; \
done
.PHONY: clean
clean:
$(info Cleaning up...)
rm -rvf dist
rm -rvf checksums
find . -type f -name '*.SHA256SUMS' -print0 | xargs -0 rm -v
# export KUBECONFIG=<path_to_kubeconfig>
# make update-drivers OCI_DRIVER_VERSION=v1.34.0
.PHONY: update-drivers
update-drivers:
ifdef OC
$(info "Updating OCI CCM and CSI drivers to ${OCI_DRIVER_VERSION}")
oc apply -f custom_manifests/oci-ccm-csi-drivers/${OCI_DRIVER_VERSION}/01-oci-ccm.yml
oc apply -f custom_manifests/oci-ccm-csi-drivers/${OCI_DRIVER_VERSION}/01-oci-csi.yml
else
$(warning "'oc' not installed. Cancelling driver update...")
endif