feat(kubeaid-agent): alert on vulnerable images that have an upgrade … - #185
Merged
Conversation
…available Restores the outdated-and-vulnerable signal that was removed from the trivy-operator chart, computed correctly this time. The alert wants the intersection of two facts: an image carries a fixable Critical/High finding, and a newer tag exists upstream. That overlap is the actionable set. A CVE with no newer image is a wait, and a newer image with no CVE is routine maintenance. The old rule tried to join those in PromQL and could not. Trivy splits and normalises registry and repository while version-checker copies the pod spec verbatim, so joining means reimplementing Docker reference grammar in chained label_replace calls. It failed silently on short-form Docker Hub references, and the fix for that wrongly rewrote registry-local ones. The agent already parses both sides with go-containerregistry, so the count is computed there and exported as a metric. One alert per cluster rather than one per image. The count is what decides whether anyone acts, and a per-image alert across a fleet produces a list nobody reads. Also alerts on collection failure, using == 0 so it stays quiet on clusters that simply do not run a scanner or Tetragon, which report -1. Collapsing those two states would make the alert fire everywhere and get it silenced, taking the real signal with it.
Twenty-five comment lines for two alerts. Keeps the three that stop someone reverting the code into a broken state: the join lives in the agent, the alert is a count so it fires once per cluster, and == 0 is load-bearing because -1 means not installed.
Collection status stays exported as a metric for dashboards and debugging, but nobody should be paged because the agent could not read a scanner. It is not a cluster problem, and it is the kind of alert that gets muted and then hides the one that matters. Leaves a single alert, firing once per cluster.
At zero this fires on any cluster with a single vulnerable image that has a newer tag, which is every cluster, every day. An alert that is always firing is an alert nobody reads.
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.
…available
Restores the outdated-and-vulnerable signal that was removed from the trivy-operator chart, computed correctly this time.
The alert wants the intersection of two facts: an image carries a fixable Critical/High finding, and a newer tag exists upstream. That overlap is the actionable set. A CVE with no newer image is a wait, and a newer image with no CVE is routine maintenance.
The old rule tried to join those in PromQL and could not. Trivy splits and normalises registry and repository while version-checker copies the pod spec verbatim, so joining means reimplementing Docker reference grammar in chained label_replace calls. It failed silently on short-form Docker Hub references, and the fix for that wrongly rewrote registry-local ones. The agent already parses both sides with go-containerregistry, so the count is computed there and exported as a metric.
One alert per cluster rather than one per image. The count is what decides whether anyone acts, and a per-image alert across a fleet produces a list nobody reads.
Also alerts on collection failure, using == 0 so it stays quiet on clusters that simply do not run a scanner or Tetragon, which report -1. Collapsing those two states would make the alert fire everywhere and get it silenced, taking the real signal with it.