Files
odo/pkg/portForward/interface.go
Parthvi Vala 010e9634d3 Use custom address for port forwarding (#6766)
* Custom address for port forwarding

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add integration tests

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Use private variables for custom address and ports

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Update pkg/util/util.go

Co-authored-by: Armel Soro <armel@rm3l.org>

* Assign custom address to HostIP for podman

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add validation for free port when --port-forward is provided in the Validate() method, add integration test for running parallel dev sessions on same platform, same port and different addresses

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Fix unit test failure

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Attempt at fixing windows failure

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Add documentation

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Use default value for --address flag

Signed-off-by: Parthvi Vala <pvala@redhat.com>

* Changes from review

Co-authored-by: Armel Soro <asoro@redhat.com>
Signed-off-by: Parthvi Vala <pvala@redhat.com>

---------

Signed-off-by: Parthvi Vala <pvala@redhat.com>
Co-authored-by: Armel Soro <armel@rm3l.org>
Co-authored-by: Armel Soro <asoro@redhat.com>
2023-05-02 07:34:19 -04:00

37 lines
1.1 KiB
Go

package portForward
import (
"context"
"io"
"github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
"github.com/devfile/library/v2/pkg/devfile/parser"
"github.com/redhat-developer/odo/pkg/api"
)
type Client interface {
// StartPortForwarding starts port forwarding for the endpoints defined in the containers of the devfile
// componentName indicates the name of component in the Devfile
// randomPorts indicates to affect random ports, instead of stable ports starting at 20001
// output will be written to errOut writer
// definedPorts allows callers to explicitly define the mapping they want to set.
StartPortForwarding(
ctx context.Context,
devFileObj parser.DevfileObj,
componentName string,
debug bool,
randomPorts bool,
out io.Writer,
errOut io.Writer,
definedPorts []api.ForwardedPort,
customAddress string,
) error
// StopPortForwarding stops the port forwarding for the specified component.
StopPortForwarding(ctx context.Context, componentName string)
// GetForwardedPorts returns the list of ports for each container currently forwarded.
GetForwardedPorts() map[string][]v1alpha2.Endpoint
}