@@ -141,7 +141,7 @@ jobs:
141141 run : |
142142 GIT_SHORT_HASH=$(git rev-parse --short HEAD)
143143
144- namespace="nightly -e2e-$STORAGE_TYPE-$GIT_SHORT_HASH-$RANDUUID4C"
144+ namespace="test-sdn -e2e-$STORAGE_TYPE-$GIT_SHORT_HASH-$RANDUUID4C"
145145
146146 echo "namespace=$namespace" >> $GITHUB_OUTPUT
147147 echo "sha_short=$GIT_SHORT_HASH" >> $GITHUB_OUTPUT
@@ -253,12 +253,15 @@ jobs:
253253 - name : Bootstrap cluster [dhctl-bootstrap]
254254 id : dhctl-bootstrap
255255 working-directory : ${{ env.SETUP_CLUSTER_TYPE_PATH }}
256- env :
257- # Proxy settings will be added to values.yaml if proxyEnabled is true via task render-cluster-config-proxy
258- HTTP_PROXY : ${{ secrets.BOOTSTRAP_DEV_PROXY }}
259- HTTPS_PROXY : ${{ secrets.BOOTSTRAP_DEV_PROXY }}
260256 run : |
257+ if [[ $(yq eval '.deckhouse.proxyEnabled' values.yaml) == true ]]; then
258+ export HTTP_PROXY="${{ secrets.BOOTSTRAP_DEV_PROXY }}"
259+ export HTTPS_PROXY="${{ secrets.BOOTSTRAP_DEV_PROXY }}"
260+ echo "Proxy settings - configured"
261+ fi
262+
261263 task dhctl-bootstrap
264+ echo "[SUCCESS] Done"
262265 timeout-minutes : 30
263266 - name : Bootstrap cluster [show-connection-info]
264267 working-directory : ${{ env.SETUP_CLUSTER_TYPE_PATH }}
@@ -432,10 +435,171 @@ jobs:
432435 include-hidden-files : true
433436 retention-days : 3
434437
438+ configure-sdn :
439+ name : Configure SDN
440+ runs-on : ubuntu-latest
441+ needs : bootstrap
442+ steps :
443+ - uses : actions/checkout@v4
444+
445+ - name : Install Task
446+ uses : arduino/setup-task@v2
447+ with :
448+ version : 3.x
449+ repo-token : ${{ secrets.GITHUB_TOKEN }}
450+
451+ - name : Setup d8
452+ uses : ./.github/actions/install-d8
453+ env :
454+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
455+
456+ - name : Install kubectl CLI
457+ uses : azure/setup-kubectl@v4
458+
459+ - name : Check nested kube-api via generated kubeconfig
460+ run : |
461+ mkdir -p ~/.kube
462+ echo "[INFO] Configure kubeconfig for nested cluster"
463+ echo "${{ needs.bootstrap.outputs.kubeconfig }}" | base64 -d | base64 -d > ~/.kube/config
464+
465+ echo "[INFO] Show paths and files content"
466+ ls -la ~/.kube
467+ echo "[INFO] Set permissions for kubeconfig"
468+ chmod 600 ~/.kube/config
469+
470+ echo "[INFO] Show current kubeconfig context"
471+ kubectl config get-contexts
472+
473+ echo "[INFO] Show nodes in cluster"
474+ # `kubectl get nodes` may return error, so we need to retry.
475+ count=30
476+ success=false
477+ for i in $(seq 1 $count); do
478+ echo "[INFO] Attempt $i/$count..."
479+ if kubectl get nodes; then
480+ echo "[SUCCESS] Successfully retrieved nodes."
481+ success=true
482+ break
483+ fi
484+
485+ if [ $i -lt $count ]; then
486+ echo "[INFO] Retrying in 10 seconds..."
487+ sleep 10
488+ fi
489+ done
490+
491+ if [ "$success" = false ]; then
492+ echo "[ERROR] Failed to retrieve nodes after $count attempts."
493+ exit 1
494+ fi
495+ - name : Enable SDN
496+ run : |
497+ echo "[INFO] Enable SDN"
498+ d8 system module enable sdn
499+ echo "[INFO] Wait for sdn modules to be ready, timeout: 300s"
500+ kubectl wait --for=jsonpath='{.status.phase}'=Ready modules sdn --timeout=300s
501+ echo "[INFO] Wait for sdn deployments to be ready, timeout: 300s"
502+ kubectl -n d8-sdn wait --for=condition=Available deploy --all --timeout 300s
503+ echo "[INFO] Wait for sdn daemonset agent to be ready, timeout: 300s"
504+ kubectl -n d8-sdn rollout status daemonset agent --timeout=300s
505+ echo "[SUCCESS] Done"
506+
507+ - name : Wait for nodenetworkinterfaces to be ready
508+ run : |
509+ count=60
510+ success=false
511+ wait_time_seconds=5
512+
513+ for i in $(seq 1 $count); do
514+ nodes=$(kubectl get nodes -o name | wc -l)
515+ actual=$(kubectl get nodenetworkinterfaces -o name 2>/dev/null | wc -l) || true
516+ expected=$((nodes * 2))
517+
518+ echo "[INFO] Attempt $i/$count: expected=$expected, actual=$actual"
519+
520+ if [ "$actual" -ge "$expected" ]; then
521+ echo "[SUCCESS] All nodenetworkinterfaces are present (expected=$expected, actual=$actual)"
522+ kubectl get nodenetworkinterfaces
523+ success=true
524+ break
525+ fi
526+
527+ if (( i % 5 == 0 )) ; then
528+ echo ::group::📝 [DEBUG] show namespaces d8-sdn
529+ kubectl -n d8-sdn get pods || true
530+ echo ::endgroup::
531+
532+ echo ::group::📝 [DEBUG] show nodenetworkinterfaces d8-sdn
533+ kubectl get nodenetworkinterfaces || true
534+ echo ::endgroup::
535+
536+ echo "[INFO] Retrying in 10 seconds..."
537+ sleep $wait_time_seconds
538+ elif [ $i -lt $count ]; then
539+ echo "[INFO] Retrying in 10 seconds..."
540+ sleep $wait_time_seconds
541+ fi
542+ done
543+
544+ if [ "$success" = false ]; then
545+ echo "[ERROR] Failed to get all nodenetworkinterfaces after $count attempts (expected=$expected)"
546+ echo "[DEBUG] Show namespaces d8-sdn"
547+ kubectl -n d8-sdn get pods || true
548+ echo "[DEBUG] Show nodenetworkinterfaces d8-sdn"
549+ kubectl get nodenetworkinterfaces || true
550+ exit 1
551+ fi
552+
553+ - name : Configure ClusterNetwork
554+ run : |
555+ extraNic=$(kubectl get nodenetworkinterfaces -l network.deckhouse.io/interface-type=NIC -o json | jq -r '.items[] | select(.status.operationalState == "Up") | select(.status.ifName != "eno1" and .status.ifName != "enp1s0") | .metadata.name')
556+
557+ for nic in $extraNic; do
558+ echo "[INFO] Label nodenetworkinterface $nic nic-group=extra"
559+ kubectl label nodenetworkinterfaces $nic nic-group=extra
560+ done
561+
562+ kubectl get nodenetworkinterface -l nic-group=extra
563+
564+ cat <<'EOF' | kubectl apply -f -
565+ ---
566+ apiVersion: network.deckhouse.io/v1alpha1
567+ kind: ClusterNetwork
568+ metadata:
569+ name: cn-4006-for-e2e-test
570+ spec:
571+ parentNodeNetworkInterfaces:
572+ labelSelector:
573+ matchLabels:
574+ nic-group: extra
575+ type: Access
576+ ---
577+ apiVersion: network.deckhouse.io/v1alpha1
578+ kind: ClusterNetwork
579+ metadata:
580+ name: cn-4007-for-e2e-test
581+ spec:
582+ parentNodeNetworkInterfaces:
583+ labelSelector:
584+ matchLabels:
585+ nic-group: extra
586+ type: VLAN
587+ vlan:
588+ id: 4007
589+ EOF
590+
591+ echo "[INFO] Wait for ClusterNetwork cn-4006-for-e2e-test to be ready"
592+ kubectl wait clusternetworks.network.deckhouse.io --for=condition=Ready cn-4006-for-e2e-test --timeout=120s
593+
594+ echo "[INFO] Wait for ClusterNetwork cn-4007-for-e2e-test to be ready"
595+ kubectl wait clusternetworks.network.deckhouse.io --for=condition=Ready cn-4007-for-e2e-test --timeout=120s
596+
435597 configure-storage :
436598 name : Configure storage
437599 runs-on : ubuntu-latest
438- needs : bootstrap
600+ needs :
601+ - configure-sdn
602+ - bootstrap
439603 steps :
440604 - uses : actions/checkout@v4
441605
@@ -1144,6 +1308,7 @@ jobs:
11441308
11451309 echo "[INFO] Exit code: $GINKGO_EXIT_CODE"
11461310 exit $GINKGO_EXIT_CODE
1311+ # exit 1
11471312 - name : Upload summary test results (junit/xml)
11481313 uses : actions/upload-artifact@v4
11491314 id : e2e-report-artifact
@@ -1338,10 +1503,11 @@ jobs:
13381503 runs-on : ubuntu-latest
13391504 needs :
13401505 - bootstrap
1506+ - configure-sdn
13411507 - configure-storage
13421508 - configure-virtualization
13431509 - e2e-test
1344- if : cancelled() || success()
1510+ if : ( cancelled() || success()) && (needs.configure-sdn.result == 'success' )
13451511 steps :
13461512 - uses : actions/checkout@v4
13471513
0 commit comments