FikaWorks / kubectl-plugins

A list of plugins that enhance the kubectl CLI
Apache License 2.0
22 stars 1 forks source link

Feature request: allow adding label selectors to prune #8

Closed pietervincken closed 4 years ago

pietervincken commented 4 years ago

As a developer I want to be able to add label selectors to the prune to limit the scope of the command In order to have more control over which secrets and configmaps get pruned.

Background

We use Kustomize and the configmapgenerator. It leaves behind quite a few unused configmaps, so using the plugin should help us a lot to mitigate this. However, the tool currently doesn't allow us to limit the prune to the configmaps that we are actively managing. We use some operators and one of those creates a configmap which is used by the operator directly through API calls and is not used in any other configuration. With labels, we could limit the prune to just the configmaps that are generated with Kustomize.

etiennetremel commented 4 years ago

@pietervincken, I added the -l --selector flag, Krew index was updated with the changes so you should be able to use it after executing kubectl krew upgrade.

pietervincken commented 4 years ago

Cool. Thank you for the quick implementation! I'll try it out tomorrow!