Skip to content

Commit

Permalink
Updates to use a hardcoded port for the kubeproxy. (Reopening #517) (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
metalcycling authored Jul 27, 2023
1 parent 586eb13 commit 9d3cb97
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions hack/run-e2e-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit 9d3cb97

Please sign in to comment.