Documentation
¶
Overview ¶
Package forwardconnection provides an easy interface to create a port forward from the local test to a service or pod inside the testing k8s cluster
Index ¶
- Constants
- func NewDialer(kubeInterface kubernetes.Interface, config *rest.Config, namespace string, ...) (httpstream.Dialer, error)
- func NewDialerFromService(ctx context.Context, kubeInterface kubernetes.Interface, config *rest.Config, ...) (dialer httpstream.Dialer, portMaps []string, err error)
- type ForwardConnection
Constants ¶
View Source
const PostgresPortMap = "0:5432"
PostgresPortMap is the default port map for the PostgreSQL Pod
Variables ¶
This section is empty.
Functions ¶
func NewDialer ¶
func NewDialer( kubeInterface kubernetes.Interface, config *rest.Config, namespace string, pod string, ) (httpstream.Dialer, error)
NewDialer returns a Dialer to be used with a PortForwarder
func NewDialerFromService ¶
func NewDialerFromService( ctx context.Context, kubeInterface kubernetes.Interface, config *rest.Config, namespace, service string, ) (dialer httpstream.Dialer, portMaps []string, err error)
NewDialerFromService returns a Dialer against the service specified
Types ¶
type ForwardConnection ¶
type ForwardConnection struct {
Forwarder *portforward.PortForwarder
// contains filtered or unexported fields
}
ForwardConnection holds the necessary information to manage a port-forward against a service of pod inside Kubernetes
func NewForwardConnection ¶
func NewForwardConnection( dialer httpstream.Dialer, portMaps []string, outWriter, errWriter io.Writer, ) (*ForwardConnection, error)
NewForwardConnection returns a PortForwarder against the pod specified
func (*ForwardConnection) GetLocalPort ¶
func (fc *ForwardConnection) GetLocalPort() (string, error)
GetLocalPort will return the local port where the forward has started
func (*ForwardConnection) StartAndWait ¶
func (fc *ForwardConnection) StartAndWait() error
StartAndWait begins the port-forwarding and waits until it's ready
Click to show internal directories.
Click to hide internal directories.