tilt-dev / tilt

Define your dev environment as code. For microservice apps on Kubernetes.
https://tilt.dev/
Apache License 2.0
7.66k stars 301 forks source link

allow giving the 'uncategorized' resource a label #5469

Open landism opened 2 years ago

landism commented 2 years ago

Describe the Feature You Want

A way to put the "uncategorized" resource into a group e.g., k8s_resource('uncategorized', labels=['mygroup']) (which might also allow other configuration on the uncategorized resource, e.g. trigger_mode)

Current Behavior

The best alternative is to make a new resource and pull all uncategorized objects into it, e.g.: k8s_resource(new_name='other', labels=['mygroup'], objects=['secrets:Service:default', 'servantes-stuff:Secret:default'])

Why Do You Want This?

  1. If you've taken the time to tidily sorted all your resources into groups, it's annoying to have this one "uncategorized" resource sticking out under "unlabeled" like a sore thumb.
  2. 'uncategorized' has not historically been easy for users to pick up, and we don't provide much help discovering options such as the one listed above under Current Behavior (which hopefully #5417 will help with)
rrmistry commented 2 months ago

At the moment, certain resources fall into uncategorized label even though they are related (just not by Kubernetes labels)

Our usage case:

We have a KeyCloak helm chart deployed with name: {{ .Release.Name }}-keycloak.

We expect that the Tilt resource for keycloak (i.e. my-release-keycloak) would contain all Kubernetes objects with the same name, but only few get categorized for keycloak and the rest end up in uncategorized.

Expected Tilt Behavior:

# 1 Tilt Resource Containing all Kubernetes Resources
# with name "my-helm-release-keycloak"
[my-helm-release-keycloak]
       my-helm-release-keycloak-headless:service
       my-helm-release-keycloak:service
       my-helm-release-keycloak:statefulset
       my-helm-release-keycloak:serviceaccount
       my-helm-release-keycloak-env-vars:configmap
       my-helm-release-keycloak:secret
       my-helm-release-keycloak-tls-passwords:secret
       my-helm-release-keycloak:poddisruptionbudget
       my-helm-release-keycloak:networkpolicy
       my-helm-release-keycloak:horizontalpodautoscaler
       my-helm-release-keycloak:certificate
       my-helm-release-keycloak:destinationrule
       my-helm-release-keycloak:virtualservice

[uncategorized]
       ...        
       # No keycloak resources

Actual Tilt Behavior:

# 1 Tilt Resource Containing some Kubernetes Resources
# with name my-helm-release-keycloak linked via label selectors
[my-helm-release-keycloak]
       my-helm-release-keycloak-headless:service
       my-helm-release-keycloak:service
       my-helm-release-keycloak:statefulset

# All other Kubernetes Resources lumped into uncategorized
[uncategorized]
       my-helm-release-keycloak:serviceaccount
       my-helm-release-keycloak-env-vars:configmap
       my-helm-release-keycloak:secret
       my-helm-release-keycloak-tls-passwords:secret
       my-helm-release-keycloak:poddisruptionbudget
       my-helm-release-keycloak:networkpolicy
       my-helm-release-keycloak:horizontalpodautoscaler
       my-helm-release-keycloak:certificate
       my-helm-release-keycloak:destinationrule
       my-helm-release-keycloak:virtualservice
       ...

This gets messy very fast when using multiple Helm Charts. Most Kubernetes resources just end up in uncategorized. It is defeating the purpose of nice resource labelling.