Repository navigation
e2e: add flannel resilience/recovery tests - #2538
Merged
Merged
Conversation
Add a new kind-based e2e spec exercising flannel recovery paths on a single cheap backend (vxlan, iptables) against the shared cluster: - pod restart recovery: delete and recreate a pod, assert cross-node connectivity recovers with the new pod IP/veth. - flannel DaemonSet rolling restart: restart kube-flannel-ds and assert pod-to-pod connectivity still works and /run/flannel/subnet.env leases (FLANNEL_SUBNET) are unchanged across the restart. Adds helpers restartFlannelDaemonSet, deletePod (idempotent), and subnetEnv. Deliberately avoids full node reboots as too flaky for CI. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Recreate the named test pods before the DaemonSet restart scenario so the ordered resilience specs do not collide with pods left by the previous scenario. Also wait for pod IP assignment before using a pod IP in connectivity checks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new kind-based e2e “resilience” spec that exercises flannel recovery behavior (pod recreation and flanneld rolling restart) on the vxlan+iptables backend, and introduces a few helper methods to support those scenarios.
Changes:
- Added
e2e/resilience_test.gowith ordered resilience/recovery scenarios for pod restart and DaemonSet rolling restart. - Added Kubernetes helper utilities for idempotent pod deletion and reading/parsing
/run/flannel/subnet.env. - Added a
kindClusterhelper to trigger a DaemonSet rolling restart via a strategic merge patch.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| e2e/resilience_test.go | New ordered resilience suite validating connectivity recovery and subnet lease stability across flannel restarts. |
| e2e/kube.go | Adds helpers for deleting a pod, reading subnet.env, extracting FLANNEL_SUBNET, and makes pod IP retrieval wait until assigned. |
| e2e/flannel.go | Adds restartFlannelDaemonSet helper to trigger a rolling restart of kube-flannel-ds. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- AfterAll now deletes the test pods it created (not just flannel) so the shared cluster is genuinely left clean for later specs. - Reword the recreated-pod comment to focus on connectivity recovery and re-wiring; host-local IPAM may legally reuse a freed IP, so the test does not require a new address. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
rbrtbnfgl
approved these changes
Aug 14, 2026
thomasferrandiz
pushed a commit
that referenced
this pull request
Aug 27, 2026
#2538 and #2537 each added a kindCluster.deletePod helper. Both changes merged cleanly, but together they leave the e2e package with duplicate method definitions. Keep the version from #2538 because its resilience callers recreate pods under the same names immediately and need deletion to finish first. The service/DNS cleanup can use the same stronger helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this covers
Adds a new spec
e2e/resilience_test.goto the kind-based e2e suite (e2ebuild tag) that exercises flannel's recovery paths. It runs on a single cheap backend — vxlan with iptables — against the shared kind cluster, installed once inBeforeAllvia the existingprepareTesthelper and torn down inAfterAllwithdeleteFlannel.Scenarios
Pod restart recovery — creates two multitool pods on separate nodes, verifies cross-node ping, then deletes and recreates one pod on the same node. Asserts connectivity recovers with the pod's new IP (re-read via
podIP), proving flannel re-wires a new pod/veth and re-allocates within the node subnet.Flannel DaemonSet rolling restart + subnet lease persistence — captures each node's
FLANNEL_SUBNETline from/run/flannel/subnet.envbefore restartingkube-flannel-ds(rollout restart via akubectl.kubernetes.io/restartedAtannotation patch on the typed AppsV1 client). AfterwaitForFlannelRollout+waitForSubnetEnv, it asserts theFLANNEL_SUBNETline is unchanged (leases stable across a flanneld restart) and that pod-to-pod connectivity still works.Helpers added
restartFlannelDaemonSet(ctx)on*kindCluster(flannel.go)deletePod(ctx, ns, name)— idempotent, ignores NotFound (kube.go)subnetEnv(ctx, node)+flannelSubnetLine(...)(kube.go)Reuses existing wait/exec helpers and code style throughout; the backend matrix in
connectivity_test.gois untouched.Design notes
Deliberately avoids full node reboots /
docker restartof a kind node — those are too flaky and slow for CI. The pod restart and DaemonSet rolling restart cover the realistic flanneld-recovery paths. Timeouts mirror the durations used elsewhere (rollout up to 5m, ping up to 1m).Validation
gofmt -l e2e— cleango vet -tags e2e ./...— cleanA real kind cluster isn't runnable in this environment (no Docker/kind), so the full suite was not executed; the change compiles and vets cleanly under the
e2ebuild tag.