Documentation ¶
Overview ¶
Package forwarder implements a Kubernetes pod port-forwarding client, similar to the `kubectl port-forward` command. Like kubectl, it can resolve an appropriate pod from a higher level object's selectors, e.g., a Service or Deployment.
Package forwarder contains a few functions that are borrowed from kubernetes/kubectl repo. They are private and cannot be used directly. https://github.com/kubernetes/kubectl/blob/0b0920722212395d20fd0eecb5abf45ecb3e0cac/pkg/cmd/portforward/portforward.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Namespace string AttachablePodForObjectFn func(resource string, namespace string, timeout time.Duration) (interface{}, *v1.Pod, error) // contains filtered or unexported fields }
Client interfaces with Kubernetes to facilitate a port-forwarding tunnel as well as fetch information about the forwarding target.
func NewClient ¶
func NewClient(timeout time.Duration, streams genericclioptions.IOStreams) *Client
NewClient returns an uninitialized forwarding client.
func (Client) Forward ¶
func (c Client) Forward(config *Config, readyChan chan Connection, stopChan chan struct{}) error
Forward creates a port-forwarding connection to the target noted by the ForwardConfig object.
func (*Client) Init ¶
func (c *Client) Init(getter genericclioptions.RESTClientGetter, version string) error
Init instantiates a Kubernetes client and rest configuration for the forwarding client.
type Config ¶
Config contains the information required to satisfy a call to Forward.
func (Config) GetLocalPort ¶
GetLocalPort returns the local ports from the Config port mapping.
type Connection ¶ added in v0.0.6
Connection stores port-forwarding information for an open connection.