Skip to content

Commit bf165cb

Browse files
adrientheboroboquat
authored andcommitted
[installer-tests] Only initialize terraform when needed for kots config
The `generate-kots-config` target depended on the `tf-init` and `tf-output` targets, but this was only used for external Gitpod dependencies. When using an in-cluster installation this init is not necessary; having `generate-kots-config` perform the lookup when unneeded makes the incluster setup more cumbersome than necessary. This commit pushes the makefile dependency down to the targets that actually consume terraform outputs.
1 parent 9123394 commit bf165cb

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

install/tests/Makefile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -248,21 +248,21 @@ get-base-config:
248248
export PATCH=$$(cat ${config_patch}) || export PATCH="" && \
249249
envsubst < ${KOTS_KONFIG} > tmp_config.yml
250250

251-
storage-config-k3s:
251+
storage-config-k3s: tf-init tf-output
252252
@export k3s_storage_credentials=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'storage.value.service_account_key_path') && \
253253
[[ $$k3s_storage_credentials = /* ]] || export k3s_storage_credentials=$$(realpath $(TF_MOD)/$$k3s_storage_credentials) && \
254254
export BASE64_GCP_KEY=$$(cat $$k3s_storage_credentials | tr -d '\n' | base64 -w 0) && \
255255
envsubst < ./manifests/kots-config-gcp-storage.yaml > tmp_2_config.yml
256256
yq m -i tmp_config.yml tmp_2_config.yml
257257

258-
registry-config-k3s:
258+
registry-config-k3s: tf-init tf-output
259259
@export k3s_registry_credentials=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'registry.value.password_file_path') && \
260260
[[ $$k3s_registry_credentials = /* ]] || export k3s_registry_credentials=$$(realpath $(TF_MOD)/$$k3s_registry_credentials) && \
261261
export GCP_KEY=$$(cat $$k3s_registry_credentials | tr -d '\n' | jq -Rsa .) && \
262262
envsubst < ./manifests/kots-config-gcp-registry.yaml > tmp_4_config.yml
263263
yq m -i tmp_config.yml tmp_4_config.yml
264264

265-
db-config-k3s:
265+
db-config-k3s: tf-init tf-output
266266
@export k3s_db_credentials=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'database.value.service_account_key_path') && \
267267
[[ $$k3s_db_credentials = /* ]] || export k3s_db_credentials=$$(realpath $(TF_MOD)/$$k3s_db_credentials) && \
268268
export BASE64_GCP_KEY=$$(cat $$k3s_db_credentials | tr -d '\n' | base64 -w 0) && \
@@ -273,19 +273,19 @@ db-config-k3s:
273273
envsubst < tmp_4_config.yml > tmp_5_config.yml
274274
yq m -i tmp_config.yml tmp_5_config.yml
275275

276-
storage-config-gcp:
276+
storage-config-gcp: tf-init tf-output
277277
@echo "Creating GCP storage configuration"
278278
@export BASE64_GCP_KEY=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'storage.value.service_account_key' | tr -d '\n' | base64 -w 0) && \
279279
envsubst < ./manifests/kots-config-gcp-storage.yaml > tmp_2_config.yml
280280
@yq m -i tmp_config.yml tmp_2_config.yml
281281

282-
registry-config-gcp:
282+
registry-config-gcp: tf-init tf-output
283283
@echo "Creating GCP registry configuration"
284284
@export GCP_KEY=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'registry.value.password' | tr -d '\n' | jq -Rsa .) && \
285285
envsubst < ./manifests/kots-config-gcp-registry.yaml > tmp_4_config.yml
286286
@yq m -i tmp_config.yml tmp_4_config.yml
287287

288-
db-config-gcp:
288+
db-config-gcp: tf-init tf-output
289289
@echo "Creating GCP database configuration"
290290
@export BASE64_GCP_KEY=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'database.value.service_account_key' | tr -d '\n' | base64 -w 0) && \
291291
export DB_INSTANCE=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'database.value.instance') && \
@@ -294,7 +294,7 @@ db-config-gcp:
294294
envsubst < ./manifests/kots-config-gcp-db.yaml > tmp_4_config.yml
295295
@envsubst < tmp_4_config.yml > tmp_5_config.yml
296296

297-
registry-config-azure:
297+
registry-config-azure: tf-init tf-output
298298
@echo "Creating Azure registry configuration"
299299
@export SERVER=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'registry.value.server') && \
300300
export URL=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'registry.value.url') && \
@@ -303,31 +303,31 @@ registry-config-azure:
303303
envsubst < ./manifests/kots-config-azure-registry.yaml > tmp_2_config.yml
304304
@yq m -i tmp_config.yml tmp_2_config.yml
305305

306-
storage-config-azure:
306+
storage-config-azure: tf-init tf-output
307307
@echo "Creating Azure storage configuration"
308308
@export USERNAME=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'storage.value.account_name') && \
309309
export PASSWORD=$$(cat ${TF_VAR_TEST_ID}-output.json| yq r - 'storage.value.account_key') && \
310310
export REGION=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'storage.value.storage_region') && \
311311
envsubst < ./manifests/kots-config-azure-storage.yaml > tmp_2_config.yml
312312
@yq m -i tmp_config.yml tmp_2_config.yml
313313

314-
db-config-azure:
314+
db-config-azure: tf-init tf-output
315315
@echo "Creating Azure database configuration"
316316
@export DBHOST=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'database.value.host') && \
317317
export DBPASS=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'database.value.password') && \
318318
export DBUSER=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'database.value.username') && \
319319
envsubst < ./manifests/kots-config-azure-db.yaml > tmp_2_config.yml
320320
@yq m -i tmp_config.yml tmp_2_config.yml
321321

322-
db-config-aws:
322+
db-config-aws: tf-init tf-output
323323
@echo "Creating AWS database configuration"
324324
@export DBHOST=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'database.value.host') && \
325325
export DBPASS=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'database.value.password') && \
326326
export DBUSER=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'database.value.username') && \
327327
envsubst < ./manifests/kots-config-aws-db.yaml > tmp_2_config.yml
328328
@yq m -i tmp_config.yml tmp_2_config.yml
329329

330-
storage-config-aws:
330+
storage-config-aws: tf-init tf-output
331331
@echo "Creating AWS storage configuration"
332332
@export REGION=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'storage.value.region') && \
333333
export ENDPOINT=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'storage.value.endpoint') && \
@@ -337,7 +337,7 @@ storage-config-aws:
337337
envsubst < ./manifests/kots-config-aws-storage.yaml > tmp_2_config.yml
338338
@yq m -i tmp_config.yml tmp_2_config.yml
339339

340-
s3-registry-backend-config-aws: # this registry config involves using s3 backend for incluster registry
340+
s3-registry-backend-config-aws: tf-init tf-output # this registry config involves using s3 backend for incluster registry
341341
@echo "Creating AWS registry backend configuration"
342342
@export REGION=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'storage.value.region') && \
343343
export ENDPOINT=$$(cat ${TF_VAR_TEST_ID}-output.json | yq r - 'storage.value.endpoint') && \
@@ -399,7 +399,7 @@ generate-kots-config: cloud_storage = $(if $(findstring external,$(storage)),$(c
399399
generate-kots-config: cloud_registry = $(if $(findstring external,$(registry)),$(cloud),incluster)
400400
generate-kots-config: cloud_db = $(if $(findstring external,$(db)),$(cloud),incluster)
401401
## generate-kots-config: Generate the kots config based on test config
402-
generate-kots-config: tf-init tf-output check-var-cloud check-var-DOMAIN check-var-TF_VAR_TEST_ID
402+
generate-kots-config: check-var-cloud check-var-DOMAIN check-var-TF_VAR_TEST_ID
403403
@if [[ $$skipTests == "false" ]]; then $(MAKE) get-github-config; fi
404404
$(MAKE) get-base-config
405405
$(MAKE) storage-config-${cloud_storage}

0 commit comments

Comments
 (0)