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.
capture_node()inhack/e2e-capture-dataplane.shassignsnode=$1andnf="$OUT/node-$node.txt"without any prefix or scoping, while its only caller bindsnodein the loop it runs from:Harmless today, because the caller passes the same
$nodeit just read, so the write lands on the value already there. It stops being harmless the moment someone callscapture_nodewith 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$nodein 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 getandconntrackrun 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
localis not the tool here.Pre-existing, not introduced by anything currently in flight.