k8

package
v0.0.0-...-4a75788 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PortForward

type PortForward struct {
	// contains filtered or unexported fields
}

PortForward encapsulates all K8 portforwarding coordination.

func StartPortForward

func StartPortForward(config clientcmd.ClientConfig, req PortForwardRequest) (*PortForward, error)

StartPortForward starts a portforward connection to a pod that is backing the requested service. If the connection was successfully established a PortForward will be returned, which exposes as methods: - The local port it is listening on - A channel which will be closed when the backing connection is closed (ex: terminated due to inactivity). - A Close method explictely close the connection.

Returns an error if the connection could not be established.

func (*PortForward) Close

func (p *PortForward) Close()

Close closes the port forward connection.

func (*PortForward) LocalPort

func (p *PortForward) LocalPort() string

LocalPort returns the local port used by the port forward struct.

func (*PortForward) StoppedChannel

func (p *PortForward) StoppedChannel() <-chan struct{}

StoppedChannel returns a channel that will be closed when the underlying connection has been closed.

type PortForwardRequest

type PortForwardRequest struct {
	Context string
	// Namespace the service runs in. Will be "default" if left blank.
	Namespace string
	// Service name.
	Service string
	// Service port.
	Port string
}

PortForwardRequest wraps the information required to portforward to a pod. Implements fmt.Stringer so the structure can easily be printed for logging.

func (PortForwardRequest) String

func (p PortForwardRequest) String() string

String func to print the request.

Jump to

Keyboard shortcuts

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