Documentation ¶
Index ¶
Constants ¶
const PortUnspecified uint16 = 0
PortUnspecified is the fallback value of the port. THe forwarder generates a random port if this value is used.
Variables ¶
var ErrEmptyPodsListed = errors.New("empty pods listed")
Functions ¶
This section is empty.
Types ¶
type ForwardHandle ¶
type ForwardHandle interface { // LocalPort returns the local port of the forwarder by remote port. LocalPort(remortPort uint16) uint16 // StopForward stops the forwarder. // It is safe to call this method multiple times. StopForward() // ErrChann returns the error channel of the forwarder. // It will be closed when the forwarder is stopped. ErrChan() <-chan error }
ForwardHandle controls access to a pod forwarder.
func Forward ¶
func Forward( forwardCtx context.Context, restConfig *rest.Config, namespace string, options ...Option, ) (ForwardHandle, error)
Forward forwards request to pod.
func ForwardWithReconnect ¶
func ForwardWithReconnect( logger logger.Logger, forwardTimeout time.Duration, backoffTicker <-chan time.Time, restConfig *rest.Config, namespace string, options ...Option, ) (ForwardHandle, error)
ForwardWithReconnect creates pod forwarder with automatic reconnection support. It bails if fails to create first connection. Errors after first connection will trigger forwarder reconnection. No error will be returned from the returned forward handle until stopped.
type FromRemotePortOption ¶
func ToLocalPort ¶
func ToLocalPort(localPort uint16) FromRemotePortOption
ToLocalPort creates a new option to specify the local port.
type Option ¶
Option specifies options for configuring the podstream reader.
func FromSelectedPods ¶
FromSelectedPods sets the label selector.
func FromService ¶
FromService sets the label selector by service name. It expects the service exists before the forwarder is created.
func WithLogger ¶
WithLogger sets the logger to be used by the streamer.
type ToLocalPortOption ¶
func FromRemotePort ¶
func FromRemotePort(remotePort uint16) ToLocalPortOption
FromRemotePort creates a new option to specify the remote port.