Repository navigation
fix: a pod that opts out while running is counted (ADR 0054) - #122
Merged
Merged
Conversation
The pod informer's AddFunc counted admission decisions and its UpdateFunc did
not, so a customer who annotated a running pod removed it from collection
without moving any counter. filter.excluded_pod_annotation stayed 0 while the
record left the go_inventory payload.
ADR 0054 already decided this should not happen. It accepts that a workload
leaving the collected set is visible to the backend by subtraction, and rests
on the count explaining why — "the alternative is silence, under which the
backend concludes the workload was deleted and tells the customer something
false". That is what shipped. No new decision here, so no new ADR.
Counting on every update would have been worse: a pod emits status updates
every few seconds and each carries the same answer. countTransition counts a
decision that differs from the one recorded in the index, so a change counts
once and a repetition counts nothing. The same rule covers the narrower
control: a workload that refuses the profiler mid-flight now moves
excluded_profiling_annotation, and removing either annotation counts the pod
observed again.
This makes the filter counters count decisions rather than pods, so adding
pods_observed to the exclusion counters no longer recovers a pod count.
backend-requirements.md says so.
four of the five new unit tests fail against the prior pods.go; the fifth
guards against double counting and passes both ways
make inventory-e2e — PASS (428s), coverage reporting
excluded_pod_annotation = 1 where it read 0 before
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KeZECJXTDHL6Nts95eKMJA
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.
The pod informer's
AddFunccounted admission decisions and itsUpdateFuncdid not. A customer who annotated a running pod removed it from collection without moving any counter:filter.excluded_pod_annotationstayed0while the record left thego_inventorypayload.Found while diagnosing #121, in the live cluster — the coverage line read
excluded_pod_annotation: 0with the pod excluded and its record already evicted.This was already decided
ADR 0054 names the exact scenario and chooses against the behaviour that shipped:
The counter not moving is the silence that ADR rejected. No new decision here, so no new ADR — this restores documented behaviour.
Why not simply count on update
A pod emits status updates every few seconds and each carries the same answer; counting state would climb forever.
countTransitioncounts a decision that differs from the one recorded in the index — presence there is the previous answer, and the entry carries whether profiling was admitted with it. A change counts once, a repetition counts nothing.The same rule covers both controls and both directions:
excluded_*counterpods_observedexcluded_profiling_annotationContract change
The
filtercounters now count decisions rather than pods, so a pod can contribute topods_observedand to an exclusion counter over its lifetime. Adding them no longer recovers a pod count.docs/backend-requirements.mdsays so normatively.Verification
Four of the five new unit tests fail against the prior
pods.go:The fifth,
TestAPodExcludedOnArrivalIsNotCountedAgain, passes both ways by design — it guards the double counting this must not introduce.In a real cluster, with a new e2e assertion that the coverage explains the departure:
🤖 Generated with Claude Code
https://claude.ai/code/session_01KeZECJXTDHL6Nts95eKMJA