Skip to content

Commit b77b816

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

1 file changed

Lines changed: 36 additions & 8 deletions

File tree

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

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -504,16 +504,44 @@ 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+
sleep 10
529+
fi
530+
done
511531
512-
echo "[INFO] Label extra nics"
532+
if [ "$success" = false ]; then
533+
echo "[ERROR] Failed to get all nodenetworkinterfaces after $count attempts (expected=$expected)"
534+
echo "[DEBUG] Show namespaces d8-sdn"
535+
kubectl -n d8-sdn get pods || true
536+
echo "[DEBUG] Show nodenetworkinterfaces d8-sdn"
537+
kubectl get nodenetworkinterfaces || true
538+
exit 1
539+
fi
540+
541+
- name: Configure ClusterNetwork
542+
run: |
513543
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')
514544
515-
echo "[INFO] Extra nics: $extraNic"
516-
echo ""
517545
for nic in $extraNic; do
518546
echo "[INFO] Label nodenetworkinterface $nic nic-group=extra"
519547
kubectl label nodenetworkinterfaces $nic nic-group=extra
@@ -549,10 +577,10 @@ jobs:
549577
EOF
550578
551579
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
580+
kubectl wait clusternetworks.network.deckhouse.io --for=condition=Ready cn-4006-for-e2e-test --timeout=60s || true
553581
554582
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
583+
kubectl wait clusternetworks.network.deckhouse.io --for=condition=Ready cn-4007-for-e2e-test --timeout=60s || true
556584
557585
configure-storage:
558586
name: Configure storage

0 commit comments

Comments
 (0)