Skip to content

Updates to use a hardcoded port for the kubeproxy. (Reopening #517) #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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