tilt icon indicating copy to clipboard operation
tilt copied to clipboard

[Feature] Have `k8s_custom_deploy` output be the `stdout` of the apply command

Open rrmistry opened this issue 1 year ago • 0 comments

Describe the Feature You Want

Return the stdout from the apply command/bat of k8s_custom_deploy as the function output in Tiltfile.

Current Behavior

The k8s_custom_deploy function returns nothing.

Why Do You Want This?

I was previously using the local(...) + k8s_yaml(...) pattern to run timoni to deploy Kubernetes resources.

This was helpful because I could simultaneously parse out the output of local(...) and group resources the way I like in the Tilt WebUI using k8s_resource.

This however used the timoni build command that generates the YAML manifests (similar to helm template ... command).

timoni also allows us to apply resources in specific orders and with Kubernetes unit testing. This is a significant quality-of-life improvement over helm.

The issue is that if we use timoni to apply resources and use Tilt's k8s_custom_deploy function then we lose the ability to parse the YAML of the applied objects and pass that into k8s_resource function. There was no way that I could find to get the stdout from k8s_custom_deploy apply command.

Having k8s_custom_deploy output the apply command feels like the easiest fix around this problem. But am open to suggestions or workarounds.

Additional context In case you try to reproduce this with timoni, note that timoni apply does not output YAML manifests as expected by Tilt's k8s_custom_deploy. It has its own console output format. So I used a wrapper script around timoni apply + timoni inspect resources when using in k8s_custom_deploy. This script is shown in https://github.com/stefanprodan/timoni/issues/454

rrmistry avatar Dec 12 '24 14:12 rrmistry