Skip to content

Commit 9d3cb97

Browse files
authored
Updates to use a hardcoded port for the kubeproxy. (Reopening #517) (#518)
* Triggering different build * Checking if nodes can be listed * Trigger build * Resource patching. Extending resources of Kubernetes nodes to include 'fake' GPUs. * Fixed command to describe nodes * Kuttl tests for checking if GPUs we added correctly to the nodes * Fixed namespace issue and node name issue. * Adding all tests again now that the resource extension passes * Changed where the extended resources are tested * Added error checks for 'curl' calls. Rename variables to use lower case. * Fixed 'if' equal operator * Reopening PR #517 here to avoid naming issues.
1 parent 586eb13 commit 9d3cb97

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

hack/run-e2e-kind.sh

+11-7
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export KUTTL_OPTIONS=${TEST_KUTTL_OPTIONS}
4848
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")
4949
DUMP_LOGS="true"
5050

51-
5251
function update_test_host {
5352

5453
local arch="$(go env GOARCH)"
@@ -380,20 +379,25 @@ function extend-resources {
380379
# This is intended to allow testing of GPU specific features such as histograms.
381380

382381
# Start communication with cluster
383-
kubectl proxy > /dev/null 2>&1 &
382+
kubectl proxy --port=0 > .port.dat 2>&1 &
384383
proxy_pid=$!
385384

386385
echo "Starting background proxy connection (pid=${proxy_pid})..."
386+
echo "Waiting for proxy process to start."
387+
sleep 30
387388

388-
curl 127.0.0.1:8001 > /dev/null 2>&1
389+
kube_proxy_port=$(cat .port.dat | awk '{split($5, substrings, ":"); print substrings[2]}')
390+
curl -s 127.0.0.1:${kube_proxy_port} > /dev/null 2>&1
389391

390392
if [[ ! $? -eq 0 ]]; then
391393
echo "Calling 'kubectl proxy' did not create a successful connection to the kubelet needed to patch the nodes. Exiting."
394+
kill -9 ${proxy_pid}
392395
exit 1
393396
else
394-
echo "Connected to the kubelet for patching the nodes"
397+
echo "Connected to the kubelet for patching the nodes. Using port ${kube_proxy_port}."
395398
fi
396399

400+
rm .port.dat
397401

398402
# Variables
399403
resource_name="nvidia.com~1gpu"
@@ -404,17 +408,17 @@ function extend-resources {
404408
do
405409
echo "- Patching node (add): ${node_name}"
406410

407-
patching_status=$(curl --header "Content-Type: application/json-patch+json" \
411+
patching_status=$(curl -s --header "Content-Type: application/json-patch+json" \
408412
--request PATCH \
409413
--data '[{"op": "add", "path": "/status/capacity/'${resource_name}'", "value": "'${resource_count}'"}]' \
410-
http://localhost:8001/api/v1/nodes/${node_name}/status | jq -r '.status')
414+
http://localhost:${kube_proxy_port}/api/v1/nodes/${node_name}/status | jq -r '.status')
411415

412416
if [[ ${patching_status} == "Failure" ]]; then
413417
echo "Failed to patch node '${node_name}' with GPU resources"
414418
exit 1
415419
fi
416420

417-
echo
421+
echo "Patching done!"
418422
done
419423

420424
# Stop communication with cluster

0 commit comments

Comments
 (0)