k8s

package
v1.5.11 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PortForwarder

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

PortForwarder can manage a port forwarding session.

func NewPortForwarder

func NewPortForwarder(restConfig *rest.Config, logger logger, opts PortForwardingOpts) (*PortForwarder, error)

NewPortForwarder creates a PortForwarder.

func (*PortForwarder) Address

func (p *PortForwarder) Address() string

Address returns an address for communicating with a port-forwarded pod.

func (*PortForwarder) Forward

func (p *PortForwarder) Forward(ctx context.Context) error

Forward attempts to initiate port forwarding a pod and port using the configured namespace and labels. An error is returned if a port forwarding session could not be started. If no error is returned, the Address method can be used to communicate with the pod, and the Stop and KeepAlive methods can be used to manage the lifetime of the port forwarding session.

func (*PortForwarder) KeepAlive

func (p *PortForwarder) KeepAlive(ctx context.Context)

KeepAlive can be used to restart the port forwarding session in the background.

func (*PortForwarder) Stop

func (p *PortForwarder) Stop()

Stop terminates a port forwarding session.

type PortForwardingOpts

type PortForwardingOpts struct {
	Namespace     string
	LabelSelector string
	LocalPort     int
	DestPort      int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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