You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(e2e): capture_node writes unprefixed node/nf and can clobber its caller's loop variable #3675
capture_node() in hack/e2e-capture-dataplane.sh assigns node=$1 and nf="$OUT/node-$node.txt" without any prefix or scoping, while its only caller binds node in the loop it runs from:
while IFS='|'read -r ns pod podip node _ready _phase;do
...
capture_node "$node"
...
agent=$(pod_on_node "$CILIUM_NS" k8s-app=cilium "$node")
Harmless today, because the caller passes the same $node it just read, so the write lands on the value already there. It stops being harmless the moment someone calls capture_node with a different node inside that loop: the assignment silently rewrites the loop variable, and the rest of that iteration follows it. Downstream of the call, the rest of the iteration reads $node in its pod lookups (k8s-app=cilium, app=ovs, app=kube-ovn-cni) and in the headers it writes. The cni lookup is the one that hurts: ip route get and conntrack run through that pod, so a swapped node yields another machine's routing and conntrack state, filed under the right pod's name. Nothing fails; the output just describes the wrong node, and reads as if it did not.
The newer code in the same file uses _cpd_ and _cpr_ prefixes for exactly this reason, so this is one of the last spots on the old convention.
Fix: prefix both variables the way the rest of the file does. The script targets POSIX sh, so local is not the tool here.
Pre-existing, not introduced by anything currently in flight.
Activity
fix(e2e): bound the dataplane capture collector by wall clock (cozyst…