`k8s_yaml` set resource name
Describe the Feature You Want
While working with a ton of different resources in a Tiltfile I stumbled upon the need to set clear resource dependencies. Surprisingly this is much easier with non-drect k8s resources such as local_resource. Being able to set an explicit resource name for all resources that will be created in a single k8s_yaml call only seems natural.
I'd imagine this feature to overwrite the default behavior of automatic resource naming, and group all resources created within a single call to the resource name explicitly set as a parameter.
Current Behavior
In my workflow I first (want to) deploy a set of CRDs defined in a kustomize file, after which I deploy a bunch of helm charts with helm_resource. To currently set up a dependency tree, I have to manually dig through resource names with tilt get uiresource, only to find out they're not clearly named, so I'd have to explicitly name them with k8s_resouce, for each CRD one by one.
Why Do You Want This?
This quickly grows to become a massive overhead when you start deploying more and more resources in a Tiltfile.
Additional context It seems like such a natural thing to explicitly name k8s resources as we can do with other resources that I wouldn't be surprised if there has been thought about this before, so am I overlooking something here that makes this hard to implement?
AFAIR, we did something like this in the very early days of tilt. You're right that it's not hard to implement.
The problem is that k8s object grouping affects a lot of things - init order, but also parallelization and restart behavior and health checking. It's hard to do well manually. And the best way to group things often didn't match how people organized their yaml on disk. So the product experience wasn't great (i.e., the easiest thing to do often wasn't a great grouping).
Most of the kubernetes install tools (including tilt, helm, and kustomize) have a lot of subtle logic baked in to install things in a good default order.
CRDs operators are a tricky case. Because you often can't figure out the right order by looking at the files.
Anecdotally, I've noticed that most CRDs these days are installed with Helm, because it has much richer controls for installation lifecycle (see this doc: https://helm.sh/docs/topics/charts_hooks/).
You can also use k8s_custom_deploy to create your own k8s deploy resource, which might work really well for this case, because then you'd only need to run kustomize at deploy time, rater than during Tiltfile execution. (You could create a kustomize_resource extension similar to helm_resource)