portforward

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

README

Portforward

Fork of go-k8s-portforward.

[ ] Readme TDB

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PortForward

type PortForward struct {
	// The parsed Kubernetes configuration file.
	Config *rest.Config
	// The initialized Kubernetes client.
	Clientset kubernetes.Interface

	// The resource name to use, required if Labels is empty.
	Name string
	// The namespace to look for the resource in.
	Namespace string

	// The labels to use to find the resource.
	Labels metav1.LabelSelector
	// The port on the resource to forward traffic to.
	DestinationPort int
	// The port that the port forward should listen to, random if not set.
	ListenPort int
	// contains filtered or unexported fields
}

Used for creating a port forward into a Kubernetes resource (service, deployment or pod) in a Kubernetes cluster.

func NewPortForwarder

func NewPortForwarder(namespace string, labels metav1.LabelSelector, port int, opts ...ResourceForwardOption) (*PortForward, error)

Initialize a port forwarder, loads the Kubernetes configuration file and creates the client. You do not need to use this function if you have a client to use already - the PortForward struct can be created directly.

func (*PortForward) Start

func (p *PortForward) Start(ctx context.Context) error

Start a port forward to a resource - blocks until the tunnel is ready for use.

func (*PortForward) Stop

func (p *PortForward) Stop()

Stop a port forward.

type ResourceForwardOption added in v1.1.0

type ResourceForwardOption func(*PortForward) *PortForward

func WithPodForward added in v1.1.0

func WithPodForward() ResourceForwardOption

func WithServiceForward added in v1.1.0

func WithServiceForward() ResourceForwardOption

Jump to

Keyboard shortcuts

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