diff --git a/hack/run-e2e-kind.sh b/hack/run-e2e-kind.sh index be9dc1b27..88555554f 100755 --- a/hack/run-e2e-kind.sh +++ b/hack/run-e2e-kind.sh @@ -48,7 +48,6 @@ export KUTTL_OPTIONS=${TEST_KUTTL_OPTIONS} export KUTTL_TEST_SUITES=("${ROOT_DIR}/test/kuttl-test.yaml" "${ROOT_DIR}/test/kuttl-test-deployment-03.yaml" "${ROOT_DIR}/test/kuttl-test-deployment-02.yaml" "${ROOT_DIR}/test/kuttl-test-deployment-01.yaml") DUMP_LOGS="true" - function update_test_host { local arch="$(go env GOARCH)" @@ -380,20 +379,25 @@ function extend-resources { # This is intended to allow testing of GPU specific features such as histograms. # Start communication with cluster - kubectl proxy > /dev/null 2>&1 & + kubectl proxy --port=0 > .port.dat 2>&1 & proxy_pid=$! echo "Starting background proxy connection (pid=${proxy_pid})..." + echo "Waiting for proxy process to start." + sleep 30 - curl 127.0.0.1:8001 > /dev/null 2>&1 + kube_proxy_port=$(cat .port.dat | awk '{split($5, substrings, ":"); print substrings[2]}') + curl -s 127.0.0.1:${kube_proxy_port} > /dev/null 2>&1 if [[ ! $? -eq 0 ]]; then echo "Calling 'kubectl proxy' did not create a successful connection to the kubelet needed to patch the nodes. Exiting." + kill -9 ${proxy_pid} exit 1 else - echo "Connected to the kubelet for patching the nodes" + echo "Connected to the kubelet for patching the nodes. Using port ${kube_proxy_port}." fi + rm .port.dat # Variables resource_name="nvidia.com~1gpu" @@ -404,17 +408,17 @@ function extend-resources { do echo "- Patching node (add): ${node_name}" - patching_status=$(curl --header "Content-Type: application/json-patch+json" \ + patching_status=$(curl -s --header "Content-Type: application/json-patch+json" \ --request PATCH \ --data '[{"op": "add", "path": "/status/capacity/'${resource_name}'", "value": "'${resource_count}'"}]' \ - http://localhost:8001/api/v1/nodes/${node_name}/status | jq -r '.status') + http://localhost:${kube_proxy_port}/api/v1/nodes/${node_name}/status | jq -r '.status') if [[ ${patching_status} == "Failure" ]]; then echo "Failed to patch node '${node_name}' with GPU resources" exit 1 fi - echo + echo "Patching done!" done # Stop communication with cluster