containers / podman-desktop

Podman Desktop is the best free and open source tool to work with Containers and Kubernetes for developers. Get an intuitive and user-friendly interface to effortlessly build, manage, and deploy containers and Kubernetes — all from your desktop.
https://podman-desktop.io
Apache License 2.0
4.8k stars 303 forks source link

k8s-port-forwarding: improve the management of port forwards objects #9637

Open axel7083 opened 1 day ago

axel7083 commented 1 day ago

Is your enhancement related to a problem? Please describe

Currently and with https://github.com/containers/podman-desktop/pull/9592 the frontend still is sending the full UserForwardConfig to the main, but this is not ideal, however we currently have no unique identifer for the port forward created, we are using `

We uses the following to get a unique identifier for the port forward

https://github.com/containers/podman-desktop/blob/4fa7dd16a29576837be6757efb139a09899b28ce/packages/main/src/plugin/kubernetes/kubernetes-port-forward-service.ts#L88-L90

We should create a uuid / uid / id when we create a port forward, this would allow to simplify the signature of the exposed methoded, as we could operate by id instead of sending the full object.

Moreover, currently we can have multiple forward for a single configuration

https://github.com/containers/podman-desktop/blob/234674a252f1fef3051e72c6fc61f7cb24ff4e66/packages/api/src/kubernetes-port-forward-model.ts#L67

This has lead to complicated mecanism to update and delete specific port instead of the full object, that has been added https://github.com/containers/podman-desktop/pull/9592, IMO this should be a temporary fix waiting for a refactor, where each port forward is a unique object, instead of an object managing multiple forward.

Lastly, we have UserForwardConfig interface, with a DisplayName but I do not see the use case where a user would be interested to define a name for a port forward?

https://github.com/containers/podman-desktop/blob/234674a252f1fef3051e72c6fc61f7cb24ff4e66/packages/api/src/kubernetes-port-forward-model.ts#L75-L80

Describe the solution you'd like

In separate PR do the following

  1. Adding uid to the ForwardConfig
  2. Making each ForwardConfig managing only one port forward
  3. Simplifying the IPC exposed methoded to use the new uid
axel7083 commented 1 day ago

cc @jeffmaury may I add this for the next sprint or is it too late ?

jeffmaury commented 1 day ago

cc @jeffmaury may I add this for the next sprint or is it too late ?

OK for next sprint