Skip to content

exclude static pods from the candidates - #716

Merged
linki merged 1 commit into
linki:masterfrom
yuminn-k:fix-exclude-static-pods
Nov 25, 2026
Merged

linki merged 1 commit into
linki:masterfrom
yuminn-k:fix-exclude-static-pods

Conversation

@yuminn-k

Copy link
Copy Markdown
Contributor

Fixes #78

Static pods are mirrored into the API server by the kubelet (annotation kubernetes.io/config.mirror). Deleting the mirror pod through the API does not stop the container, and the kubelet recreates the mirror right away, so chaoskube can never actually kill them.

This adds filterStaticPods, which drops pods carrying that annotation, and calls it in Candidates next to filterTerminatingPods. The README's filtering section mentions it.

Behavior change: mirror pods are now always excluded; there is no flag to opt back in. If you would rather have a flag, I can add one.

Tests: TestCandidatesExcludesStaticPods creates a pod with the mirror annotation next to two regular pods and expects only the regular ones as candidates. It fails on master (3 candidates instead of 2) and passes with the change. GODEBUG=randseednop=0 go test ./... -race -cover and go vet ./... pass.

@linki

linki commented Nov 19, 2026

Copy link
Copy Markdown
Owner

@yuminn-k Thanks a lot!

@linki
linki merged commit d33feb1 into linki:master Nov 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exclude static pods from termination

2 participants