Skip to content

Commit

Permalink
missing change
Browse files Browse the repository at this point in the history
  • Loading branch information
apesternikov committed Oct 17, 2022
1 parent a594272 commit 291af34
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions skylib/k8s_test_namespace.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ TEST_UNDECLARED_OUTPUTS_DIR=${TEST_UNDECLARED_OUTPUTS_DIR:-.}

KUBECTL=%{kubectl}
KUBECONFIG=%{kubeconfig}
CLUSTER_FILE=%{cluster}

SET_NAMESPACE=%{set_namespace}
IT_MANIFEST_FILTER=%{it_manifest_filter}

Expand All @@ -32,8 +34,8 @@ NAMESPACE_NAME_FILE=${TEST_UNDECLARED_OUTPUTS_DIR}/namespace
KUBECONFIG_FILE=${TEST_UNDECLARED_OUTPUTS_DIR}/kubeconfig

# get cluster and username from provided configuration
CLUSTER=$(${KUBECTL} --kubeconfig=${KUBECONFIG} config view -o jsonpath='{.clusters[0].name}')
USER=$(${KUBECTL} --kubeconfig=${KUBECONFIG} config view -o jsonpath='{.users[0].name}')
CLUSTER=$(cat ${CLUSTER_FILE})
USER=$(${KUBECTL} --kubeconfig=${KUBECONFIG} config view -o jsonpath='{.users[?(@.name == '"\"${CLUSTER}\")].name}")

echo "Cluster: ${CLUSTER}" >&2
echo "User: ${USER}" >&2
Expand All @@ -53,7 +55,7 @@ else
DELETE_NAMESPACE_FLAG="-delete_namespace"
COUNT="0"
while true; do
NAMESPACE=${USER}-$(( (RANDOM) + 32767 ))
NAMESPACE=`whoami`-$(( (RANDOM) + 32767 ))
${KUBECTL} --kubeconfig=${KUBECONFIG} --cluster=${CLUSTER} --user=${USER} create namespace ${NAMESPACE} && break
COUNT=$[$COUNT + 1]
if [ $COUNT -ge 10 ]; then
Expand Down

0 comments on commit 291af34

Please sign in to comment.