Is your feature request related to a problem? Please describe.
Currently, helm-release-pruner only filters Helm releases by name, namespace, age, and count, but not by labels. Teams often apply labels to their Helm releases to indicate environment, ownership, automation status or lifecycle stage. Not being able to filter or prune by label limits automation, especially in environments with ephemeral or preview releases.
Example use case: prune only releases labeled garbage-collection-policy=weekly (combined with --older-than 1w). Using a label allows changing policy without changing release name.
Describe the solution you'd like
Add new CLI flags such as --label-filter and --label-exclude that support Kubernetes label selector syntax, allowing users to filter which Helm releases are considered for pruning based on their labels. This should be fully combinable with existing filters. Positive and negative (exclude) label selectors should both be supported.
Implementation could leverage the Labels map available on the Helm release object (see https://github.com/helm/helm/blob/2f51ffe93cac5dff964ba3eafad5d924b47f9d86/pkg/release/v1/release.go#L50).
Describe alternatives you've considered
I've considered encoding the prune trigger in the release name, as it is currently implemented. I think using labels would be more versatile.
Is your feature request related to a problem? Please describe.
Currently, helm-release-pruner only filters Helm releases by name, namespace, age, and count, but not by labels. Teams often apply labels to their Helm releases to indicate environment, ownership, automation status or lifecycle stage. Not being able to filter or prune by label limits automation, especially in environments with ephemeral or preview releases.
Example use case: prune only releases labeled
garbage-collection-policy=weekly(combined with--older-than 1w). Using a label allows changing policy without changing release name.Describe the solution you'd like
Add new CLI flags such as
--label-filterand--label-excludethat support Kubernetes label selector syntax, allowing users to filter which Helm releases are considered for pruning based on their labels. This should be fully combinable with existing filters. Positive and negative (exclude) label selectors should both be supported.Implementation could leverage the
Labelsmap available on the Helm release object (see https://github.com/helm/helm/blob/2f51ffe93cac5dff964ba3eafad5d924b47f9d86/pkg/release/v1/release.go#L50).Describe alternatives you've considered
I've considered encoding the prune trigger in the release name, as it is currently implemented. I think using labels would be more versatile.