Skip to content

Commit c477617

Browse files
add wait nni
Signed-off-by: Nikita Korolev <nikita.korolev@flant.com>
1 parent b3246e2 commit c477617

1 file changed

Lines changed: 42 additions & 8 deletions

File tree

.github/workflows/e2e-reusable-pipeline.yml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,16 +504,50 @@ jobs:
504504
kubectl -n d8-sdn rollout status daemonset agent --timeout=300s
505505
echo "[SUCCESS] Done"
506506
507-
- name: Configure ClusterNetwork
507+
- name: Wait for nodenetworkinterfaces to be ready
508508
run: |
509-
echo "[INFO] Get all nics"
510-
kubectl get nodenetworkinterfaces
509+
count=60
510+
success=false
511+
512+
for i in $(seq 1 $count); do
513+
nodes=$(kubectl get nodes -o name | wc -l)
514+
actual=$(kubectl get nodenetworkinterfaces -o name | wc -l || echo 0)
515+
expected=$((nodes * 2))
516+
517+
echo "[INFO] Attempt $i/$count: expected=$expected, actual=$actual"
518+
519+
if [ "$actual" -ge "$expected" ]; then
520+
echo "[SUCCESS] All nodenetworkinterfaces are present (expected=$expected, actual=$actual)"
521+
kubectl get nodenetworkinterfaces
522+
success=true
523+
break
524+
fi
525+
526+
if [ $i -lt $count ]; then
527+
echo "[INFO] Retrying in 10 seconds..."
528+
echo ::group::📝 show namespaces d8-sdn
529+
kubectl -n d8-sdn get pods || true
530+
echo ::endgroup::
531+
echo ::group::📝 show nodenetworkinterfaces d8-sdn
532+
kubectl get nodenetworkinterfaces || true
533+
echo ::endgroup::
534+
sleep 10
535+
fi
536+
done
511537
512-
echo "[INFO] Label extra nics"
538+
if [ "$success" = false ]; then
539+
echo "[ERROR] Failed to get all nodenetworkinterfaces after $count attempts (expected=$expected)"
540+
echo "[DEBUG] Show namespaces d8-sdn"
541+
kubectl -n d8-sdn get pods || true
542+
echo "[DEBUG] Show nodenetworkinterfaces d8-sdn"
543+
kubectl get nodenetworkinterfaces || true
544+
exit 1
545+
fi
546+
547+
- name: Configure ClusterNetwork
548+
run: |
513549
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')
514550
515-
echo "[INFO] Extra nics: $extraNic"
516-
echo ""
517551
for nic in $extraNic; do
518552
echo "[INFO] Label nodenetworkinterface $nic nic-group=extra"
519553
kubectl label nodenetworkinterfaces $nic nic-group=extra
@@ -549,10 +583,10 @@ jobs:
549583
EOF
550584
551585
echo "[INFO] Wait for ClusterNetwork cn-4006-for-e2e-test to be ready"
552-
kubectl wait clusternetworks.network.deckhouse.io --for=condition=Ready cn-4006-for-e2e-test --timeout=300s || true
586+
kubectl wait clusternetworks.network.deckhouse.io --for=condition=Ready cn-4006-for-e2e-test --timeout=60s || true
553587
554588
echo "[INFO] Wait for ClusterNetwork cn-4007-for-e2e-test to be ready"
555-
kubectl wait clusternetworks.network.deckhouse.io --for=condition=Ready cn-4007-for-e2e-test --timeout=300s || true
589+
kubectl wait clusternetworks.network.deckhouse.io --for=condition=Ready cn-4007-for-e2e-test --timeout=60s || true
556590
557591
configure-storage:
558592
name: Configure storage

0 commit comments

Comments
 (0)