@@ -4,7 +4,7 @@ CHANNEL_UNSTABLE = Unstable
4
4
CHARTS_DIR = charts
5
5
YAML_DIR = manifests
6
6
7
- all : logo helm lint create_dev_release
7
+ all : generate_preflight_checks logo helm lint create_dev_release
8
8
9
9
create_dev_release :
10
10
@if [ " ${REPLICATED_DEV_CHANNEL} " = " " ]; then \
@@ -24,6 +24,31 @@ create_unstable_release:
24
24
replicated release create --lint --ensure-channel --yaml-dir ${YAML_DIR} --promote ${CHANNEL_UNSTABLE}
25
25
.PHONY : create_unstable_release
26
26
27
+ generate_preflight_checks :
28
+ @echo " Generating installation config validation preflight check"
29
+
30
+ # Extract the installer job
31
+ @yq r manifests/gitpod-installer-job.yaml spec.template.spec > /tmp/installer-job.yaml
32
+ # Remove the envFrom block
33
+ @yq d -i /tmp/installer-job.yaml containers[0].envFrom
34
+
35
+ # Extract the envFrom block as envvars and convert to "env" format
36
+ @yq r -j manifests/gitpod-kots-config.yaml data > /tmp/installer-envvars.json
37
+
38
+ @for row in $$(cat /tmp/installer-envvars.json | jq -r 'to_entries | .[] | @base64'); do \
39
+ yq w -i /tmp/installer-job.yaml containers[0].env[+].name "$$(echo $${row} | base64 -d | jq -r '.key')"; \
40
+ yq w -i /tmp/installer-job.yaml containers[0].env[-1].value "$$(echo $${row} | base64 -d | jq -r '.value')"; \
41
+ done
42
+
43
+ # Set as dry run
44
+ @yq w -i /tmp/installer-job.yaml containers[0].env[+].name "INSTALLER_DRY_RUN"
45
+ @yq w --tag=!!str -i /tmp/installer-job.yaml containers[0].env[-1].value "true"
46
+
47
+ # Merge the envvars into the installer job
48
+ @yq p -i /tmp/installer-job.yaml spec.collectors[0].runPod.podSpec
49
+ @yq m -i manifests/kots-preflight.yaml /tmp/installer-job.yaml
50
+ .PHONY : generate_preflight_checks
51
+
27
52
helm :
28
53
@echo " Installing Helm dependencies"
29
54
@rm -f ${YAML_DIR} /* .tgz
0 commit comments