Skip to content

feat(helm): discover releases from object labels without reading Secrets - #175

Merged
mayankpande88 merged 1 commit into
mainfrom
feat/release-source-labels
Nov 18, 2026
Merged

mayankpande88 merged 1 commit into
mainfrom
feat/release-source-labels

Conversation

@mayankpande88

Copy link
Copy Markdown
Contributor

Description

nova find reads installed releases from Helm's release Secrets, which needs cluster-wide list on Secrets. Where the service account is not allowed that, nova exits with secrets is forbidden and reports nothing. This adds a way to find releases without touching Secrets.

  • New flag nova find --release-source labels. It lists deployments, statefulsets, daemonsets, cronjobs, services and configmaps that carry the helm.sh/chart label (or the older chart label). It then groups them by the meta.helm.sh/release-name / release-namespace annotations.
  • A release whose objects carry more than one chart label is an umbrella chart. The parent chart can't be recovered from labels, so the release is skipped rather than reported as one of its subcharts.
  • Label-sourced releases have no chart metadata (home, sources, maintainers) to score Artifact Hub candidates on. So a candidate only counts if it published the installed version; otherwise the release gets no latest version rather than a guess.
  • The default (--release-source secrets) is unchanged.

Alternatives considered:

  • Granting list on Secrets: RBAC can't narrow that to Helm's Secrets, so it would expose every Secret in the cluster.
  • Building the release list outside the cluster: this couples nova to an external inventory, and that inventory missed releases the in-cluster read finds.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

How to verify: with a service account that can list workloads but not Secrets, run nova find --release-source labels --format json. It exits 0 and lists the releases. The same account without the flag fails with secrets is forbidden.

Engineering detail
  • splitChartLabel splits <name>-<version> at the leftmost - where the rest is strict semver (x.y.z). Failing that, it accepts x.y, but only with a dot, so foo-2-bar-1.0.0 splits correctly. _ is read back as +.
  • Lists are paged (500). A kind the account can't list is skipped; the run only fails if every list fails.
  • The new logging is at V(2), so stderr stays empty at the default verbosity.
  • Tests: label splitting, grouping and umbrella skip, release namespace fallback, a forbidden kind, legacy chart label (fake clientset), and version-gated Artifact Hub matching. go test ./... and golangci-lint run are clean.
  • Docs: README fork table and usage, CHANGELOG.

Local e2e: built the binary and ran nova find against a real multi-release cluster while impersonating a service account without Secrets access. The default source failed with secrets is forbidden. --release-source labels exited 0 with empty stderr and found 37 of 44 releases. Of the 16 releases the Secrets source marks outdated, 12 came back with the same latest version. Not found: one CRD-only chart and one umbrella chart; plus one release where the two sources picked different repos, and one Secrets-side match to an unrelated same-name chart.

Add 'nova find --release-source labels'. It reads installed releases from the
helm.sh/chart (or older chart) label and meta.helm.sh/release-* annotations on
deployments, statefulsets, daemonsets, cronjobs, services and configmaps, so
the service account needs no list permission on Secrets.

Releases whose objects carry more than one chart label (umbrella charts) are
skipped, since the parent chart cannot be recovered from labels. With no chart
metadata to score on, Artifact Hub matches are limited to packages that
published the installed version. The default source (secrets) is unchanged.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new --release-source labels option for nova find, allowing the discovery of installed Helm releases directly from object labels (e.g., helm.sh/chart) and annotations on workloads, services, and configmaps. This enables release discovery without requiring cluster-wide Secret read permissions. The changes include CLI flag updates, adjustments to Artifact Hub matching logic for label-discovered releases, and a new implementation with unit tests. The review feedback suggests adding a nil check for the Kubernetes client in GetHelmReleasesFromLabels to prevent potential nil pointer dereferences, and checking ctx.Err() within the resource listing loop to handle context cancellation or timeouts gracefully.

Comment thread pkg/helm/labels.go Resolved
Comment thread pkg/helm/labels.go Resolved
@mayankpande88
mayankpande88 merged commit 980b8de into main Nov 18, 2026
4 checks passed
@mayankpande88
mayankpande88 deleted the feat/release-source-labels branch November 18, 2026 10:22
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.

2 participants