portforward

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WhiteBoxPortForwardCycle added in v0.34.0

func WhiteBoxPortForwardCycle(t *testing.T, kubectlCLI *kubectl.CLI, namespace string)

For WhiteBox testing only This is testing a port forward + stop + restart in a simulated dev cycle

Types

type EntryForwarder

type EntryForwarder interface {
	Forward(parentCtx context.Context, pfe *portForwardEntry)
	Terminate(p *portForwardEntry)
}

type EntryManager

type EntryManager struct {
	EntryForwarder
	// contains filtered or unexported fields
}

EntryManager handles forwarding entries and keeping track of forwarded ports and resources.

func NewEntryManager

func NewEntryManager(out io.Writer, cli *kubectl.CLI) EntryManager

NewEntryManager returns a new port forward entry manager to keep track of forwarded ports and resources

func (*EntryManager) Stop

func (b *EntryManager) Stop()

Stop terminates all kubectl port-forward commands.

func (*EntryManager) Terminate

func (b *EntryManager) Terminate(p *portForwardEntry)

Terminate terminates a single port forward entry

type Forwarder

type Forwarder interface {
	Start(ctx context.Context) error
	Stop()
}

Forwarder is an interface that can modify and manage port-forward processes

type ForwarderManager

type ForwarderManager struct {
	EntryForwarder
	Forwarders []Forwarder
	// contains filtered or unexported fields
}

ForwarderManager manages all forwarders

func NewForwarderManager

func NewForwarderManager(out io.Writer, cli *kubectl.CLI, podSelector kubernetes.PodSelector, namespaces []string, label string, opts config.PortForwardOptions, userDefined []*latest.PortForwardResource) *ForwarderManager

NewForwarderManager returns a new port manager which handles starting and stopping port forwarding

func (*ForwarderManager) Start

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

Start begins all forwarders managed by the ForwarderManager

func (*ForwarderManager) Stop

func (p *ForwarderManager) Stop()

Stop cleans up and terminates all forwarders managed by the ForwarderManager

type KubectlForwarder

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

func NewKubectlForwarder added in v0.37.0

func NewKubectlForwarder(out io.Writer, cli *kubectl.CLI) *KubectlForwarder

NewKubectlForwarder returns a new KubectlForwarder

func (*KubectlForwarder) Forward

func (k *KubectlForwarder) Forward(parentCtx context.Context, pfe *portForwardEntry)

Forward port-forwards a pod using kubectl port-forward in the background It kills the command on errors in the kubectl port-forward log It restarts the command if it was not cancelled by skaffold It retries in case the port is taken

func (*KubectlForwarder) Terminate

func (*KubectlForwarder) Terminate(p *portForwardEntry)

Terminate terminates an existing kubectl port-forward command using SIGTERM

type ResourceForwarder

type ResourceForwarder struct {
	EntryManager
	// contains filtered or unexported fields
}

ResourceForwarder is responsible for forwarding user defined port forwarding resources and automatically forwarding services deployed by skaffold.

func NewResourceForwarder

func NewResourceForwarder(em EntryManager, namespaces []string, label string, userDefinedResources []*latest.PortForwardResource) *ResourceForwarder

NewResourceForwarder returns a struct that tracks and port-forwards pods as they are created and modified

func (*ResourceForwarder) Start

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

Start gets a list of services deployed by skaffold as []latest.PortForwardResource and forwards them.

type WatchingPodForwarder

type WatchingPodForwarder struct {
	EntryManager
	// contains filtered or unexported fields
}

WatchingPodForwarder is responsible for selecting pods satisfying a certain condition and port-forwarding the exposed container ports within those pods. It also tracks and manages the port-forward connections.

func NewWatchingPodForwarder

func NewWatchingPodForwarder(em EntryManager, podSelector kubernetes.PodSelector, namespaces []string) *WatchingPodForwarder

NewWatchingPodForwarder returns a struct that tracks and port-forwards pods as they are created and modified

func (*WatchingPodForwarder) Start

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

Jump to

Keyboard shortcuts

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