Skip to content

fix: clear outdated_helm_chart for charts no longer referenced - #2036

Merged
gianlucam76 merged 1 commit into
projectsveltos:mainfrom
Kitio-Tek:clear-unreferenced-outdated-charts
Oct 15, 2026
Merged

gianlucam76 merged 1 commit into
projectsveltos:mainfrom
Kitio-Tek:clear-unreferenced-outdated-charts

Conversation

@Kitio-Tek

@Kitio-Tek Kitio-Tek commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2030

reconcileOutdatedHelmChartMetric carried forward every outdated chart that was not checked in the current pass. That is meant for a chart whose repository could not be fetched, but it also caught a chart that no ClusterSummary references anymore: its ClusterSummary was deleted, or the chart was removed from the profile. Such a chart is never checked again, so its outdated_helm_chart series stayed at 1 until the addon-controller restarted.

The pass now records the charts it collects from the ClusterSummaries (markReferenced), and reconcileOutdatedHelmChartMetric carries forward only an unchecked chart that is still referenced. A chart whose fetch failed keeps its series, as before. I also fixed the comment on outdatedHelmChartGauge: it said the gauge is reset on every pass, which the checker deliberately doesn't do.

The tests in helmchart_outdated_check_test.go run a whole checkOutdatedHelmCharts pass against a fake client, after a pass that found the chart outdated:

  • the ClusterSummary was deleted: the series is gone;
  • the chart was removed from the profile: the series is gone;
  • the repository can't be reached: the series stays;
  • the chart is up to date, from an index served by httptest: the series is gone.

make test and make lint pass.

@gianlucam76 this follows the direction from the issue.

reconcileOutdatedHelmChartMetric carried forward every outdated chart
that was not checked in the current pass. That is meant for a chart
whose repository could not be fetched, but it also kept a chart that no
ClusterSummary references anymore, because its ClusterSummary was
deleted or the chart was removed from its profile. Such a chart is
never checked again, so its outdated_helm_chart series stayed at 1
until the addon-controller restarted.

Record in the pass state the charts collected from the ClusterSummaries,
and carry forward only the ones that are still referenced.
@gianlucam76
gianlucam76 merged commit 11cd89a into projectsveltos:main Oct 15, 2026
22 checks passed
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.

BUG: outdated_helm_chart keeps reporting charts that are no longer referenced

2 participants