Repository navigation
feat(helm): discover releases from object labels without reading Secrets - #175
Conversation
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.
There was a problem hiding this comment.
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.
Description
nova findreads installed releases from Helm's release Secrets, which needs cluster-wideliston Secrets. Where the service account is not allowed that, nova exits withsecrets is forbiddenand reports nothing. This adds a way to find releases without touching Secrets.nova find --release-source labels. It lists deployments, statefulsets, daemonsets, cronjobs, services and configmaps that carry thehelm.sh/chartlabel (or the olderchartlabel). It then groups them by themeta.helm.sh/release-name/release-namespaceannotations.--release-source secrets) is unchanged.Alternatives considered:
liston Secrets: RBAC can't narrow that to Helm's Secrets, so it would expose every Secret in the cluster.Type of change
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 withsecrets is forbidden.Engineering detail
splitChartLabelsplits<name>-<version>at the leftmost-where the rest is strict semver (x.y.z). Failing that, it acceptsx.y, but only with a dot, sofoo-2-bar-1.0.0splits correctly._is read back as+.V(2), so stderr stays empty at the default verbosity.chartlabel (fake clientset), and version-gated Artifact Hub matching.go test ./...andgolangci-lint runare clean.Local e2e: built the binary and ran
nova findagainst a real multi-release cluster while impersonating a service account without Secrets access. The default source failed withsecrets is forbidden.--release-source labelsexited 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.