-
Notifications
You must be signed in to change notification settings - Fork 2.3k
DPF: Run network tests directly from Prow #82742
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,159 +1,19 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| # Configuration | ||
| REMOTE_HOST="${REMOTE_HOST:-10.6.135.45}" | ||
| CLUSTER_NAME=$(cat "${CLUSTER_PROFILE_DIR}/cluster-name") | ||
| cp "${SHARED_DIR}/.env" . | ||
|
|
||
| echo "Setting up SSH access to DPF hypervisor: ${REMOTE_HOST}" | ||
| echo "=== Run DPF Kubernetes Traffic Flow Tests ===" | ||
|
|
||
| # Prepare SSH key from Vault (add trailing newline if missing) | ||
| echo "Configuring SSH private key..." | ||
| cat /var/run/dpf-ci/private-key | base64 -d > /tmp/id_rsa | ||
| echo "" >> /tmp/id_rsa | ||
| chmod 600 /tmp/id_rsa | ||
| echo "Verifying cluster access..." | ||
| oc get nodes | ||
|
|
||
| # Define SSH command with explicit options (don't rely on ~/.ssh/config) | ||
| SSH_OPTS="-i /tmp/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -o ConnectTimeout=30 -o ServerAliveInterval=10 -o ServerAliveCountMax=3 -o BatchMode=yes" | ||
|
|
||
| # Test SSH connection | ||
| echo "Testing SSH connection to ${REMOTE_HOST}..." | ||
| if ssh ${SSH_OPTS} root@${REMOTE_HOST} echo 'SSH connection successful'; then | ||
| echo "SSH setup complete and tested successfully" | ||
| else | ||
| echo "ERROR: Failed to connect to hypervisor ${REMOTE_HOST}" | ||
| echo "Debug information:" | ||
| echo "- Checking if SSH key exists:" | ||
| ls -la /tmp/id_rsa | ||
| echo "- Testing SSH connectivity with verbose output:" | ||
| ssh -v ${SSH_OPTS} root@${REMOTE_HOST} echo 'test' || true | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Export SSH settings for subsequent steps | ||
| echo "REMOTE_HOST=${REMOTE_HOST}" >> ${SHARED_DIR}/dpf-env | ||
| echo "SSH_OPTS=${SSH_OPTS}" >> ${SHARED_DIR}/dpf-env | ||
| echo "SSH setup completed successfully for ${REMOTE_HOST}" | ||
|
|
||
| echo "Remote host: ${REMOTE_HOST}" | ||
|
|
||
| datetime_string=$(date +"%Y-%m-%d_%H-%M-%S") | ||
| NETWORK_TESTS_RESULT="" | ||
|
|
||
| # Run dpf make target checks test | ||
| REMOTE_LAST_OPENSHIFT_DPF_DIR_LOCATION="/root/${CLUSTER_NAME}/ci/last-openshift-dpf-dir.sh" | ||
|
|
||
| echo "=== DPF Make Target checks on Existing Cluster ===" | ||
| echo "Using openshift-dpf dir from last cluster-deploy: '${REMOTE_LAST_OPENSHIFT_DPF_DIR_LOCATION}'" | ||
|
|
||
| echo "Updating VERIFY_DEPLOYMENT, VERIFY_MAX_RETRIES and VERIFY_SLEEP_SECONDS variable values to true, 4 and 3 respectively in .env file" | ||
| # Using delimiter '|' since we have '/' in the patterns | ||
| if ssh ${SSH_OPTS} root@${REMOTE_HOST} "set -e; \ | ||
| test -f ${REMOTE_LAST_OPENSHIFT_DPF_DIR_LOCATION}; \ | ||
| source ${REMOTE_LAST_OPENSHIFT_DPF_DIR_LOCATION}; \ | ||
| echo \${LAST_OPENSHIFT_DPF}; \ | ||
| cd \${LAST_OPENSHIFT_DPF}; \ | ||
| pwd ; \ | ||
| set -e; \ | ||
| test -f .env ; \ | ||
| cat .env | grep VERIFY ; \ | ||
| cp .env .env_orig ; \ | ||
| sed -i 's|VERIFY_DEPLOYMENT=.*|VERIFY_DEPLOYMENT=true|' .env ; \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need those lines to shorten the duration and update the .env file in case the dpus are not ready, otherwise the test will wait up to the max iterations initially used during DPF deploy-cluster
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll have a sanity step before the network one, the idea for the network one is to be focused on the networking testing itself. |
||
| sed -i 's|VERIFY_MAX_RETRIES=.*|VERIFY_MAX_RETRIES=4|' .env ; \ | ||
| sed -i 's|VERIFY_SLEEP_SECONDS=.*|VERIFY_SLEEP_SECONDS=3|' .env ; \ | ||
| cat .env | grep VERIFY"; then | ||
| echo "VERIFY_DEPLOYMENT, VERIFY_MAX_RETRIES and VERIFY_SLEEP_SECONDS variables updated successfully in .env file" | ||
| else | ||
| echo "ERROR: Failed to update VERIFY_DEPLOYMENT, VERIFY_MAX_RETRIES and VERIFY_SLEEP_SECONDS variables in .env file" | ||
| exit 1 | ||
| fi | ||
|
|
||
|
|
||
| if ssh ${SSH_OPTS} root@${REMOTE_HOST} "set -a; \ | ||
| pwd; \ | ||
| ls -ltr; \ | ||
| env; \ | ||
| source ${REMOTE_LAST_OPENSHIFT_DPF_DIR_LOCATION}; \ | ||
| echo \${LAST_OPENSHIFT_DPF}; \ | ||
| env; \ | ||
| cd \${LAST_OPENSHIFT_DPF}; \ | ||
| pwd; \ | ||
| set -e;\ | ||
| export KUBECONFIG=\${LAST_OPENSHIFT_DPF}/kubeconfig.${CLUSTER_NAME}; \ | ||
| oc get co; \ | ||
| oc get nodes; \ | ||
| oc get dpu -A; \ | ||
| oc get application -A; \ | ||
| echo \${KUBECONFIG}; \ | ||
| ls -ltr ; \ | ||
| make verify-workers; \ | ||
| make verify-dpu-nodes; \ | ||
| make verify-deployment; \ | ||
| make verify-dpudeployment; \ | ||
| echo \$? > verification-result"; then | ||
|
|
||
| echo "DPF spot check tests Passed"; | ||
|
|
||
| else | ||
| echo "DPF spot checks tests Failed"; | ||
| exit 1 | ||
| fi | ||
|
|
||
|
|
||
| echo "=== Run DPF Kubernetes Traffic Flow Tests on Existing Cluster ===" | ||
|
|
||
| # Need to export the dpu-workers after they are renamed, on hypervisor: | ||
| # export TFT_SERVER_NODE=worker-303ea713ea90 | ||
| # export TFT_CLIENT_NODE=worker-303ea713ea94 | ||
|
|
||
| if ssh ${SSH_OPTS} root@${REMOTE_HOST} "set -euo pipefail; \ | ||
| ls -ltr; \ | ||
| env; \ | ||
| source ${REMOTE_LAST_OPENSHIFT_DPF_DIR_LOCATION}; \ | ||
| echo \${LAST_OPENSHIFT_DPF}; \ | ||
| env; \ | ||
| cd \${LAST_OPENSHIFT_DPF}; \ | ||
| pwd; \ | ||
| ls -ltra; \ | ||
| set -e;\ | ||
| export KUBECONFIG=\${LAST_OPENSHIFT_DPF}/kubeconfig.${CLUSTER_NAME}; \ | ||
| oc get nodes; \ | ||
| export TFT_SERVER_NODE=\$(oc get nodes | grep worker-dpu | awk 'NR==1 {print \$1}'); \ | ||
| echo \${TFT_SERVER_NODE} ;\ | ||
| export TFT_CLIENT_NODE=\$(oc get nodes | grep worker-dpu | awk 'NR==2 {print \$1}'); \ | ||
| echo \${TFT_CLIENT_NODE} ; \ | ||
| source ${REMOTE_LAST_OPENSHIFT_DPF_DIR_LOCATION}; \ | ||
| echo \${LAST_OPENSHIFT_DPF}; \ | ||
| make run-traffic-flow-tests 2>&1 | tee log-traffic-flow-tests-${datetime_string}"; then | ||
|
|
||
| echo "Kubernetes Network Traffic Flow Iperf Tests Passed"; | ||
| NETWORK_TESTS_RESULT="PASS" | ||
|
|
||
| else | ||
| echo "Kubernetes Network Traffic Flow Iperf Tests Failed"; | ||
|
|
||
| fi | ||
|
|
||
| echo "====== Output DPF Kubernetes Traffic Flow Tests Log file:" | ||
| if ssh ${SSH_OPTS} root@${REMOTE_HOST} "source ${REMOTE_LAST_OPENSHIFT_DPF_DIR_LOCATION}; \ | ||
| echo \${LAST_OPENSHIFT_DPF}; \ | ||
| env; \ | ||
| cd \${LAST_OPENSHIFT_DPF}; \ | ||
| cat log-traffic-flow-tests-${datetime_string}"; then | ||
|
|
||
| echo "Successfully output Kubernetes Network Traffic Flow Iperf Tests logs"; | ||
|
|
||
| else | ||
| echo "Failed to output DPF kubernetes Traffic Flow Iperf Tests logs"; | ||
|
|
||
| fi | ||
|
|
||
| # Parse the log files, may need to scp to container running ssh cmds and process the | ||
| # output file and exit accordingly | ||
|
|
||
| if [ "${NETWORK_TESTS_RESULT}" == "PASS" ]; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| exit 1 | ||
| export TFT_KUBECONFIG="${SHARED_DIR}/kubeconfig" | ||
| TFT_SERVER_NODE=$(oc get nodes --no-headers | grep worker-dpu | awk 'NR==1 {print $1}') | ||
| export TFT_SERVER_NODE | ||
| echo "TFT_SERVER_NODE: ${TFT_SERVER_NODE}" | ||
| TFT_CLIENT_NODE=$(oc get nodes --no-headers | grep worker-dpu | awk 'NR==2 {print $1}') | ||
| export TFT_CLIENT_NODE | ||
| echo "TFT_CLIENT_NODE: ${TFT_CLIENT_NODE}" | ||
|
|
||
| make run-traffic-flow-tests | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Export
KUBECONFIGbefore you useoc.The step never sets
KUBECONFIG, soocuses the default CI cluster credentials instead of the DPF cluster kubeconfig written bydpf-hypervisor-load-kubeconfig. Theref.yamldocumentation states that this step consumes${SHARED_DIR}/kubeconfig, and the sibling stepci-operator/step-registry/dpf/hypervisor/test-full-suite/dpf-hypervisor-test-full-suite-commands.sh(line 6) exports it explicitly. Without the export,oc get nodesqueries the wrong cluster and the node selection below silently yields empty values.🐛 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents