Skip to content

Commit e77349e

Browse files
committed
Tiltfile: fix templating cluster name
I'm not even sure how this could work previously, as envsubst works only with environment variables, not with shell variables. Perhaps cd4342a broke it by moving CLUSTER_NAME from Tilt-based substitutions to envsubst. In any case, exporting CLUSTER_NAME makes envsubst properly populate resource names, which fixes the problem. Signed-off-by: Mateusz Gozdek <[email protected]>
1 parent 0a54399 commit e77349e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Tiltfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def deploy_worker_templates(template, substitutions):
349349

350350
yaml = shlex.quote(yaml)
351351
flavor_name = os.path.basename(flavor)
352-
flavor_cmd = "RANDOM=$(bash -c 'echo $RANDOM'); CLUSTER_NAME=" + flavor.replace("windows", "win") + "-$RANDOM; make generate-flavors; echo " + yaml + "> ./.tiltbuild/" + flavor + "; cat ./.tiltbuild/" + flavor + " | " + envsubst_cmd + " | " + kubectl_cmd + " apply -f - && echo \"Cluster \'$CLUSTER_NAME\' created, don't forget to delete\""
352+
flavor_cmd = "RANDOM=$(bash -c 'echo $RANDOM'); export CLUSTER_NAME=" + flavor.replace("windows", "win") + "-$RANDOM; make generate-flavors; echo " + yaml + "> ./.tiltbuild/" + flavor + "; cat ./.tiltbuild/" + flavor + " | " + envsubst_cmd + " | " + kubectl_cmd + " apply -f - && echo \"Cluster \'$CLUSTER_NAME\' created, don't forget to delete\""
353353

354354
# wait for kubeconfig to be available
355355
flavor_cmd += "; until " + kubectl_cmd + " get secret ${CLUSTER_NAME}-kubeconfig > /dev/null 2>&1; do sleep 5; done; " + kubectl_cmd + " get secret ${CLUSTER_NAME}-kubeconfig -o jsonpath={.data.value} | base64 --decode > ./${CLUSTER_NAME}.kubeconfig; chmod 600 ./${CLUSTER_NAME}.kubeconfig; until " + kubectl_cmd + " --kubeconfig=./${CLUSTER_NAME}.kubeconfig get nodes > /dev/null 2>&1; do sleep 5; done"

0 commit comments

Comments
 (0)