forwardconnection

package
v1.26.0-rc3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

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

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

Jump to

Keyboard shortcuts

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