Skip to content

Commit a151864

Browse files
adds option to overide CLUSTER argument in k8s_test_setup using the K8S_TEST_CLUSTER test_env variable (#51)
1 parent d358aba commit a151864

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

skylib/k8s_test_namespace.sh.tpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ NAMESPACE_NAME_FILE=${TEST_UNDECLARED_OUTPUTS_DIR}/namespace
3939
KUBECONFIG_FILE=${TEST_UNDECLARED_OUTPUTS_DIR}/kubeconfig
4040

4141
# get cluster and username from provided configuration
42-
CLUSTER=$(cat ${CLUSTER_FILE})
42+
if [ -n "${K8S_TEST_CLUSTER:-}" ]
43+
then
44+
CLUSTER=${K8S_TEST_CLUSTER}
45+
else
46+
CLUSTER=$(cat ${CLUSTER_FILE})
47+
fi
48+
4349
USER=$(${KUBECTL} --kubeconfig=${KUBECONFIG} config view -o jsonpath='{.users[?(@.name == '"\"${CLUSTER}\")].name}")
4450

4551
echo "Cluster: ${CLUSTER}" >&2

0 commit comments

Comments
 (0)