fix(kubernetes_logs source): don't evict recreated pods with reused names#25558
Draft
thomasqueirozb wants to merge 1 commit into
Draft
fix(kubernetes_logs source): don't evict recreated pods with reused names#25558thomasqueirozb wants to merge 1 commit into
thomasqueirozb wants to merge 1 commit into
Conversation
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.
Summary
The
kubernetes_logssource could randomly stop collecting logs from a pod after another pod with the same name and namespace was deleted and recreated (e.g.StatefulSetrollouts or same-node restarts). The delayed processing of the old pod's deletion event evicted the recreated pod from the reflector store, which is keyed only by name and namespace. Once evicted, Vector stopped watching that pod's log files and emittedFailed to annotate event with pod metadataerrors.Pod incarnations are now distinguished by their UID (
MetaDescribe), and a delayed deletion is only applied if the store still holds the same UID. This is the piece missing from the earlier attempt in #21303, which added the UID to the cache but did not guard the store deletion and therefore regressed the recreate case.Vector configuration
NA
How did you test this PR?
Added two regression tests in
src/kubernetes/reflector.rscovering both event orderings (recreate within the delay window, and an out-of-order delete arriving after the recreate). Verified that neutralizing the new store guard makes both tests fail (reproducing #21303's behavior) and that they pass with the guard in place. Rancargo test --no-default-features --features kubernetes --lib kubernetes::andcargo clippy --no-default-features --features kubernetes --lib.Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
kubernetes_logssource seems to fail to annotate when pod names are reused #13467