Repository navigation
Conversation
ahauserv
force-pushed
the
fix/mark-superseded-replicaset-reports
branch
from
October 13, 2026 09:59
c111fdd to
e7735d0
Compare
With scanOnlyCurrentRevisions enabled, SkipProcessing checked for pods before checking whether a ReplicaSet or ReplicationController is the current revision. MarkOldReportForImmediateDeletion was therefore only reachable while a superseded revision still had pod objects, i.e. during the scale-down of a rollout. If the operator missed that window (restart, backlog, requeue after a failed Deployment lookup, pods terminating immediately), every later reconcile hit the "no active pods" return first and the stale reports lived on until the report TTL expired, 24h by default. Check the revision first so an inactive revision is marked whether or not it still has pods. The "no active pods" skip now only applies to the current revision.
ahauserv
force-pushed
the
fix/mark-superseded-replicaset-reports
branch
from
November 16, 2026 14:08
e7735d0 to
9133935
Compare
This branch has not been deployed
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.
Description
With
scanOnlyCurrentRevisionsenabled,SkipProcessingchecked for pods before checking whether aReplicaSet(orReplicationController) is the current revision.MarkOldReportForImmediateDeletionwas therefore only reachable while a superseded revision still had pod objects, i.e. during the scale-down of a rollout. If the ReplicaSet had no pods at that moment (Deployment scaled to 0 before the template change, or the reconcile came after the pods were gone because of an operator restart or backlog), every later reconcile of the old ReplicaSet returned atIgnoring ReplicaSet with no active podsand the stale reports stayed until the report TTL expired (24h by default), reporting vulnerabilities of an image that no longer runs.Reproduction in the linked issue.
This PR swaps the two checks: the current-revision check runs first, so an inactive revision is marked for immediate deletion whether or not it still has pods. The "no active pods" skip now only applies to the current revision. Same change for
ReplicationController.Before, for an old ReplicaSet scaled to 0:
and its reports keep
trivy-operator.aquasecurity.github.io/report-ttl: 24h0m0s.After:
and its reports get
report-ttl: 0sand are removed by the TTL reconciler on the next reconcile.Tests: new
pkg/operator/workload/helper_test.gocovers inactive/active ReplicaSet with and without pods, and an inactive ReplicationController without pods. The two "inactive without pods" cases fail onmain.Related issues
Checklist