Skip to content

Commit

Permalink
adds option to overide CLUSTER argument in k8s_test_setup using the K…
Browse files Browse the repository at this point in the history
…8S_TEST_CLUSTER test_env variable (#51)
  • Loading branch information
michaelschiff authored Nov 6, 2024
1 parent d358aba commit a151864
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion skylib/k8s_test_namespace.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ NAMESPACE_NAME_FILE=${TEST_UNDECLARED_OUTPUTS_DIR}/namespace
KUBECONFIG_FILE=${TEST_UNDECLARED_OUTPUTS_DIR}/kubeconfig

# get cluster and username from provided configuration
CLUSTER=$(cat ${CLUSTER_FILE})
if [ -n "${K8S_TEST_CLUSTER:-}" ]
then
CLUSTER=${K8S_TEST_CLUSTER}
else
CLUSTER=$(cat ${CLUSTER_FILE})
fi

USER=$(${KUBECTL} --kubeconfig=${KUBECONFIG} config view -o jsonpath='{.users[?(@.name == '"\"${CLUSTER}\")].name}")

echo "Cluster: ${CLUSTER}" >&2
Expand Down

0 comments on commit a151864

Please sign in to comment.