vmware-archive / octant

Highly extensible platform for developers to better understand the complexity of Kubernetes clusters.
https://octant.dev
Apache License 2.0
6.28k stars 488 forks source link

Predefined port forward range #1699

Open jmdacruz opened 3 years ago

jmdacruz commented 3 years ago

Describe the problem/challenge you have When running octant inside a docker image (using docker compose), the port forwarding function won't work.

Describe the solution you'd like Provide a configuration parameter to octant with a local port range to use for port forwarding. Octant should attempt to use a port in the provided range.

Anything else you would like to add: By using a predefined port range, the user can now forward this entire port range in docker or docker compose.

Environment:

GuessWhoSamFoo commented 3 years ago

This isn't officially supported as Octant is intended to run as a desktop application. It looks possible based on https://github.com/kubernetes/client-go/blob/master/tools/portforward/portforward.go#L75 and have Octant choose a port randomly instead.

It'd be helpful to have information on your use case and see if we can prioritize this issue accordingly

jmdacruz commented 3 years ago

Thanks for the link to the code! I guess it would be enough to allow selecting the local port on the UI since the parsePorts function allows for things such as :5000 or 4000:5000 (with 4000 being the local port). With regards to the use case, imagine a development environment where people share a docker image with all the Kubernetes tools and context/configuration (e.g. kubectl, kubectx, authentication plugins, etc.), so that people don't have to setup everything from scratch on their environments. Based on this image you can create another one that simply adds the octant CLI for people to launch.