Documentation ¶
Index ¶
- type Option
- func WithDeployment(name, namespace string) Option
- func WithKindCluster(kindClusterName string) Option
- func WithKubeContext(kubeContext string) Option
- func WithPod(name, namespace string) Option
- func WithPorts(localPort, remotePort int) Option
- func WithRemotePort(remotePort int) Option
- func WithResource(name, namespace, resourceType string) Option
- func WithResourceSelector(resourceSelector, namespace string) Option
- func WithService(name, namespace string) Option
- func WithWriters(out, err io.Writer) Option
- type PortForwarder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*properties)
func WithDeployment ¶
func WithKindCluster ¶
func WithKubeContext ¶
func WithRemotePort ¶
func WithResource ¶
func WithResourceSelector ¶
WithResourceSelector takes a kubectl-style selector like `deployment/<name>` or `pod/<name>` and tries to construct the correct Option for it.
If no `<resource>/<name>` style selector supplied, assumes a raw pod name has been provided.
func WithService ¶
func WithWriters ¶
type PortForwarder ¶
type PortForwarder interface { // Start runs this PortForwarder. Start(ctx context.Context, options ...retry.Option) error // Address returns the local forwarded address. Only valid while the apiPortForwarder is running. Address() string // Close this apiPortForwarder and release any resources. Close() // ErrChan returns a channel that returns an error when one is encountered. While Start() may return an initial error, // the port-forward connection may be lost at anytime. The ErrChan can be read to determine if/when the port-forwarding terminates. // This can return nil if the port forwarding stops gracefully. ErrChan() <-chan error // WaitForStop blocks until connection closed (e.g. control-C interrupt) WaitForStop() }
PortForwarder manages the forwarding of a single port. Implementations are NOT thread-safe, as the goroutine that Starts the PortForward should also be the one that Closes it
func NewApiPortForwarder ¶
func NewApiPortForwarder(options ...Option) PortForwarder
NewApiPortForwarder returns an implementation of a PortForwarder that does not rely on the Kubernetes CLI but instead queries the Kubernetes API directly This implementation is preferred, but we have seen it fail occassionally with the following error:
portforward.go:394] error copying from local connection to remote stream: EOF
func NewCliPortForwarder ¶
func NewCliPortForwarder(options ...Option) PortForwarder
NewCliPortForwarder returns an implementation of a PortForwarder that relies on the Kubernetes CLI to perform port-forwarding This implementation is NOT thread-safe
func NewPortForwarder ¶
func NewPortForwarder(options ...Option) PortForwarder
NewPortForwarder returns an implementation of a PortForwarder