tilt icon indicating copy to clipboard operation
tilt copied to clipboard

group configmaps with the pod they're attached to

Open coltfred opened this issue 4 months ago • 5 comments

Expected Behavior

When using Kustomize to create a k8s_resource configmaps that are created using disableNameSuffixHash: false are correctly grouped with the creating service. The reason I want to use disableNameSuffixHash: false is so I can get automatic restarting of services if the configmaps change.

Current Behavior

When using Kustomize to create a k8s_resource configmaps that are created using disableNameSuffixHash: false are put into uncategorized and are not dependencies of the service that depends on them.

This means if you start the service without running all of the uncategorized you get output like:

[event: pod echo-server-5c8f5bf978-q7d4x] MountVolume.SetUp failed for volume "config-volume" : configmap "echo-server-config-ddhgt4bhk2" not found

Steps to Reproduce

Expand tilt.zip and after you run tilt up, enable the echo-server and you'll see the errors about configmap not found.

Context

tilt doctor Output

Tilt: v0.33.21, built
System: darwin-arm64
---
Docker
- Host: unix:///Users/colt/.docker/run/docker.sock
- Server Version: 28.3.2
- API Version: 1.51
- Builder: 2
- Compose Version: v2.38.2-desktop.1
---
Kubernetes
- Env: kind
- Context: kind-kind
- Cluster Name: kind-kind
- Namespace: default
- Container Runtime: containerd
- Version: v1.32.2
- Cluster Local Registry: none
---
Thanks for seeing the Tilt Doctor!
Please send the info above when filing bug reports. 💗

About Your Use Case

In a real world application I have 20+ services that all need to depend on their configmaps. If you want to just start a few of the services, you have to enable uncategorized which causes all of them to be created.

coltfred avatar Aug 21 '25 17:08 coltfred

For what it's worth - all config maps are expected to go in uncategorized. But typically tilt will apply uncategorized before other resources. Will need to poke around at why you're getting errors.

nicks avatar Aug 22 '25 01:08 nicks

ah, i looked at your sample code, and this is working like i'd expect. you've disabled all the resources, so the configmap can't be found. see my above comment.

nicks avatar Aug 24 '25 02:08 nicks

@nicks In my experience with tilt, having things in uncategorized is unexpected. For instance today (with static configmaps) we have a service definition like:

k8s_yaml(kustomize('ironcore-id'))
k8s_resource(workload='ironcore-id-server',
             new_name='ironcore-id',
             labels=["ironcore"],
             links=["https://dev1.scrambledbits.org:8443"],
             objects=["ironcore:namespace", "api-server-ingress:ingress", "ironcore-id-config:configmap", "ironcore-id-logs:configmap", "ironcore-id-tls:secret"],
             port_forwards="9090:9090",
             resource_deps=["db-fixtures", "ironadmin-schema-upgrade", "identity-schema-upgrade"])

This makes the configmaps, logs and secrets grouped with the service ironcore-id which means when I create that service, the config maps and secrets will be created. I want this same behavior when using config maps that kustomize creates (with the hashed names).

The reason I disabled everything in the example was purely to show how it could be confusing, but I still think it's not intended that kustomize users should have to put every configmap and secret into uncategorized and apply them all together. Grouping using objects keeps it nice and tidy.

Does that make sense?

coltfred avatar Aug 25 '25 21:08 coltfred

ok, going to reframe this as a feature request to make configmaps group with the pod they're attached to

nicks avatar Aug 27 '25 03:08 nicks

Thank you so much. I can see how you'd consider it an enhancement.

coltfred avatar Aug 28 '25 15:08 coltfred