Skip to content

feat(kubeaid-agent): alert on vulnerable images that have an upgrade … - #185

Merged
ashish1099 merged 4 commits into
masterfrom
feat/kubeaid-agent-cve-alerts
Aug 12, 2026
Merged

feat(kubeaid-agent): alert on vulnerable images that have an upgrade …#185
ashish1099 merged 4 commits into
masterfrom
feat/kubeaid-agent-cve-alerts

Conversation

@ashish1099

Copy link
Copy Markdown
Member

…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.

…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.
@ashish1099
ashish1099 merged commit f438c32 into master Aug 12, 2026
4 checks passed
@ashish1099
ashish1099 deleted the feat/kubeaid-agent-cve-alerts branch August 12, 2026 10:39
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.

1 participant