portforward

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WhiteBoxPortForwardCycle added in v0.34.0

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

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) error
	Terminate(p *portForwardEntry)
	Monitor(*portForwardEntry, func())
}

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) EntryManager

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

func (*EntryManager) Retry added in v0.34.1

func (b *EntryManager) Retry(ctx context.Context, p *portForwardEntry) error

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, 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{}

func (*KubectlForwarder) Forward

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

Forward port-forwards a pod using kubectl port-forward It returns an error only if the process fails or was terminated by a signal other than SIGTERM

func (*KubectlForwarder) Monitor added in v0.34.1

func (*KubectlForwarder) Monitor(p *portForwardEntry, retryFunc func())

Monitor monitors the logs for a kubectl port forward command If it sees an error, it calls back to the EntryManager to retry the entire port forward operation.

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, 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