portforward

package
v0.0.0-...-2bcb20d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForwardPorts

func ForwardPorts(
	conf *rest.Config,
	namespace string,
	podName string,
	portMapping []string,
	stopChan <-chan struct{},
	errChan chan error,
	timeout time.Duration,
) error

ForwardPorts spawns a goroutine that does the equivalent of "kubectl port-forward -n <namespace> <podName> [portMapping]". The connection will remain open until stopChan is closed. Use errChan for receiving errors from the port-forward goroutine.

Example:

stopCh := make(chan struct{}, 1)
errCh := make(chan error)
if err = ForwardPorts(conf, "my-ns", "my-pod", []string{"5000:5000"}, stopCh, errCh, time.Minute); err != nil {
    return err
}
defer func() {
    close(stopCh)
    close(errCh)
}()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL