fwdport

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostFileWithLock

type HostFileWithLock struct {
	Hosts *txeh.Hosts
	sync.Mutex
}

HostFileWithLock

type HostsParams

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

HostsParams

type PortForwardOpts

type PortForwardOpts struct {
	Out        *fwdpub.Publisher
	Config     restclient.Config
	ClientSet  kubernetes.Clientset
	RESTClient restclient.RESTClient

	Service    string
	ServiceFwd ServiceFWD
	PodName    string
	PodPort    string
	LocalIp    net.IP
	LocalPort  string
	HostFile   *HostFileWithLock

	// Context is a unique key (string) in kubectl config representing
	// a user/cluster combination. Kubefwd uses context as the
	// cluster name when forwarding to more than one cluster.
	Context string

	// Namespace is the current Kubernetes Namespace to locate services
	// and the pods that back them for port-forwarding
	Namespace string

	// ClusterN is the ordinal index of the cluster (from configuration)
	// cluster 0 is considered local while > 0 is remote
	ClusterN int

	// NamespaceN is the ordinal index of the namespace from the
	// perspective of the user. Namespace 0 is considered local
	// while > 0 is an external namespace
	NamespaceN int

	Domain         string
	HostsParams    *HostsParams
	Hosts          []string
	ManualStopChan chan struct{} // Send a signal on this to stop the portforwarding
	DoneChan       chan struct{} // Listen on this channel for when the shutdown is completed.
}

PortForwardOpts

func (*PortForwardOpts) AddHosts

func (pfo *PortForwardOpts) AddHosts()

AddHosts adds hostname entries to /etc/hosts

func (*PortForwardOpts) ListenUntilPodDeleted

func (pfo *PortForwardOpts) ListenUntilPodDeleted(stopChannel <-chan struct{}, pod *v1.Pod)

listen for pod is deleted

func (*PortForwardOpts) PortForward

func (pfo *PortForwardOpts) PortForward() error

PortForward does the port-forward for a single pod. It is a blocking call and will return when an error occurred or after a cancellation signal has been received.

func (*PortForwardOpts) Stop

func (pfo *PortForwardOpts) Stop()

Stop sends the shutdown signal to the port-forwarding process. In case the shutdown signal was already given before, this is a no-op.

func (*PortForwardOpts) WaitUntilPodRunning

func (pfo *PortForwardOpts) WaitUntilPodRunning(stopChannel <-chan struct{}) (*v1.Pod, error)

Waiting for the pod running

type ServiceFWD

type ServiceFWD interface {
	String() string
	SyncPodForwards(bool)
}

ServiceFWD PodSyncer interface is used to represent a fwdservice.ServiceFWD reference, which cannot be used directly due to circular imports. It's a reference from a pod to it's parent service.

Jump to

Keyboard shortcuts

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