carvel-dev / kapp

kapp is a simple deployment tool focused on the concept of "Kubernetes application" — a set of resources with the same label
https://carvel.dev/kapp
Apache License 2.0
904 stars 108 forks source link

support labels for app-groups #380

Closed universam1 closed 2 years ago

universam1 commented 2 years ago

Describe the problem/challenge you have We like to annotate certain apps in order to filter them later for cleanup.

I see that kapp deploy --labels ... is supported, but that flag is not available under kapp app-group deploy.

Background: We like to run a cronjob that removes test deployments that are older than a week, keeping production deployments. Devs are able to create preview deployments for acceptance test, but if they forget to clean them up they keep lingering and filling up the cluster. We cannot simply remove the namespace, we need to filter on apps. So something like an annotation or label I assume could do the trick to mark production type apps, but this is not supported with app-groups

Describe the solution you'd like adding labels for app-group deployments like it is available for normal deployment

Anything else you would like to add:

Assuming label is applied, what are your steps in finding them (by label and age) and deleting them?

renuy commented 2 years ago

https://kubernetes.slack.com/archives/CH8KCCKA5/p1637229778419800

renuy commented 2 years ago

Two feature set

  1. add --label flag on app-group command (only deploy)
  2. add --filter-label and --filter-age flag for list (kapp ls) command. Ideally, user should be able to kapp deploy --labels dev=yes ... kapp ls --filter-labels dev=yes --filter-age ... --column name | xargs -I{} kapp delete -a {}
renuy commented 2 years ago

Hi @universam1 , This looks like a valid ask. We will add it to our unprirotized backlog. However, if you want to take up the issue and submit a PR for the same, we would love to help you out with reviews and pointers for code change!

renuy commented 2 years ago

@cppforlife , do you think it would be a good Idea to add --show-labels flag, on the kapp ls command. @sethiyash , @rohitagg2020 If yes, then If there are multiple labels, how do show all the labels in the table.

renuy commented 2 years ago

Release v0.46.0