Skip to content

Commit 9efd611

Browse files
authored
Add e2e reset cleanup verification
1 parent 2e42ba1 commit 9efd611

2 files changed

Lines changed: 57 additions & 2 deletions

File tree

hack/e2e/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AKS Flex Node E2E Tests
22

3-
The E2E suite provisions an AKS cluster and three Ubuntu VMs in Azure, joins the VMs as Flex Nodes, validates workloads, exercises unjoin/rejoin behavior, validates repave, collects logs, and tears down the resources.
3+
The E2E suite provisions an AKS cluster and three Ubuntu VMs in Azure, joins the VMs as Flex Nodes, validates workloads, exercises unjoin/rejoin behavior, verifies reset cleanup, validates repave, collects logs, and tears down the resources.
44

55
## Prerequisites
66

@@ -30,7 +30,7 @@ The default `all` command runs:
3030
2. Deploy AKS and three VMs with Bicep.
3131
3. Join all three VMs.
3232
4. Validate node readiness, node-problem-detector status, and run smoke workloads.
33-
5. Unjoin all Flex Nodes and verify they are absent.
33+
5. Unjoin all Flex Nodes and verify they are absent, including reset cleanup of host network artifacts.
3434
6. Rejoin all Flex Nodes and validate again.
3535
7. Run local-machine-driven repave validation.
3636
8. Collect logs and clean up Azure resources.

hack/e2e/lib/node-join.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ _rp_delete_unjoin_node() {
149149
local vm_ip="$1"
150150
local vm_name="$2"
151151

152+
_seed_reset_cleanup_artifacts "${vm_ip}"
153+
152154
log_info "Deleting local Machine resource on ${vm_ip}..."
153155
remote_exec "${vm_ip}" 'bash -s' <<'REMOTE'
154156
set -euo pipefail
@@ -170,6 +172,31 @@ REMOTE
170172
kubectl delete node "${vm_name}" --ignore-not-found --wait=false
171173
}
172174

175+
_seed_reset_cleanup_artifacts() {
176+
local vm_ip="$1"
177+
178+
log_info "Seeding reset cleanup artifacts on ${vm_ip}..."
179+
remote_exec "${vm_ip}" 'bash -s' <<'REMOTE'
180+
set -euo pipefail
181+
182+
sudo mkdir -p /etc/wireguard
183+
printf 'e2e private key\n' | sudo tee /etc/wireguard/server.priv >/dev/null
184+
printf 'e2e public key\n' | sudo tee /etc/wireguard/server.pub >/dev/null
185+
186+
sudo modprobe dummy 2>/dev/null || true
187+
for iface in wg51898 geneve0 vxlan0 ipip0 unbounded0 cbr0; do
188+
if ! ip link show "${iface}" &>/dev/null; then
189+
sudo ip link add "${iface}" type dummy
190+
fi
191+
done
192+
193+
sudo ip rule add fwmark 0xca6a table 51898 2>/dev/null || true
194+
sudo ip route replace blackhole 198.51.100.254/32 table 51898
195+
196+
echo "Reset cleanup artifacts seeded"
197+
REMOTE
198+
}
199+
173200
_wait_for_node_not_ready_or_absent() {
174201
local vm_name="$1"
175202
local timeout="${E2E_NODE_JOIN_TIMEOUT}"
@@ -230,6 +257,34 @@ for machine in kube1 kube2; do
230257
fi
231258
done
232259
260+
for iface in wg51898 geneve0 vxlan0 ipip0 unbounded0 cbr0; do
261+
if [[ -e "/sys/class/net/${iface}" ]]; then
262+
echo "reset cleanup interface ${iface} still exists"
263+
ip link show "${iface}" || true
264+
exit 1
265+
fi
266+
done
267+
268+
for path in /etc/wireguard/server.priv /etc/wireguard/server.pub; do
269+
if [[ -e "${path}" ]]; then
270+
echo "reset cleanup WireGuard key ${path} still exists"
271+
sudo ls -l "${path}" || true
272+
exit 1
273+
fi
274+
done
275+
276+
if ip rule show | grep -Eq 'lookup 51898|table 51898'; then
277+
echo "reset cleanup policy routing rule for table 51898 still exists"
278+
ip rule show
279+
exit 1
280+
fi
281+
282+
if ip route show table 51898 | grep -q .; then
283+
echo "reset cleanup route table 51898 is not empty"
284+
ip route show table 51898
285+
exit 1
286+
fi
287+
233288
for path in /etc/aks-flex-node /var/log/aks-flex-node; do
234289
if [[ -e "${path}" ]]; then
235290
echo "runtime path ${path} still exists after delete"

0 commit comments

Comments
 (0)