tilt icon indicating copy to clipboard operation
tilt copied to clipboard

Provide a way to hide port-forwards in the Tilt UI

Open psigen opened this issue 3 years ago • 3 comments

When I am developing APIs that are used internally (e.g. REST or gRPC), I need to create port-forwards to things that do not display a webpage, but are used by other applications. In these situations, I want to add a Link to a k8s_resource referencing my other application that uses an API, and not show an HTTP address to the API endpoint itself in the Tilt UI.

One example is when I am running a GraphQL Playground separately that connects to a graphql API. I do not want to show the API endpoint as an HTTP URL in the Tilt UI. Instead, I can add a Link to the GraphQL Playground website where I can make interactive calls to the API using my port-forward.

Unfortunately, there does not seem to be any option to create a port-forward and completely hide or make non-clickable the hyperlink in the UI. https://github.com/tilt-dev/tilt/blob/d79b05e6a6f667e0a34599878a36394590fc8932/pkg/model/manifest.go#L448-L450

This has been pretty confusing for my users, since they get a set of links like http://localhost:8080 that just show error codes if clicked. Right now I am using the option name="dontclickme", but this is a silly workaround.

psigen avatar Feb 11 '22 19:02 psigen

Thanks for the request! Ya, i wonder if we can come up with a way to configure this that's intuitive.

nicks avatar Feb 14 '22 18:02 nicks

One option that might make sense is to define a sentinel value like PortForward.AUTO and make that the default, and switch the value of name=None to suppress the port visibility.

This would let folks do:

port_forward(...)                           # Default behavior of showing port name
port_forward(..., name = PortForward.AUTO)  # Default behavior of showing port name
port_forward(..., name = None)              # Do not display anything on the UI

psigen avatar Feb 14 '22 19:02 psigen

Came across this with something similar as I'm exposing an additional port for a websocket for my app. Another thought is you could make the visibility explicit, e.g.

port_forward(..., ui = False)

wuservices avatar Aug 24 '22 23:08 wuservices