watch

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugFactory

func DebugFactory(f *Factory, ns string, gvr string)

DebugFactory for debug.

func DumpFactory

func DumpFactory(f *Factory)

DumpFactory for debug.

Types

type Factory

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

Factory tracks various resource informers.

func NewFactory

func NewFactory(client client.Connection) *Factory

NewFactory returns a new informers factory.

func (*Factory) AddForwarder

func (f *Factory) AddForwarder(pf Forwarder)

AddForwarder registers a new portforward for a given container.

func (*Factory) CanForResource

func (f *Factory) CanForResource(ns, gvr string, verbs []string) (informers.GenericInformer, error)

CanForResource return an informer is user has access.

func (*Factory) Client

func (f *Factory) Client() client.Connection

Client return the factory connection.

func (*Factory) DeleteForwarder

func (f *Factory) DeleteForwarder(path string)

DeleteForwarder deletes portforward for a given container.

func (*Factory) FactoryFor

func (f *Factory) FactoryFor(ns string) di.DynamicSharedInformerFactory

FactoryFor returns a factory for a given namespace.

func (*Factory) ForResource

func (f *Factory) ForResource(ns, gvr string) (informers.GenericInformer, error)

ForResource returns an informer for a given resource.

func (*Factory) ForwarderFor

func (f *Factory) ForwarderFor(path string) (Forwarder, bool)

ForwarderFor returns a portforward for a given container or nil if none exists.

func (*Factory) Forwarders

func (f *Factory) Forwarders() Forwarders

Forwarders returns all portforwards.

func (*Factory) Get

func (f *Factory) Get(gvr, fqn string, wait bool, sel labels.Selector) (runtime.Object, error)

Get retrieves a given resource.

func (*Factory) HasSynced

func (f *Factory) HasSynced(gvr, ns string) (bool, error)

HasSynced checks if given informer is up to date.

func (*Factory) List

func (f *Factory) List(gvr, ns string, wait bool, labels labels.Selector) ([]runtime.Object, error)

List returns a resource collection.

func (*Factory) SetActiveNS

func (f *Factory) SetActiveNS(ns string) error

SetActiveNS sets the active namespace.

func (*Factory) Start

func (f *Factory) Start(ns string)

Start initializes the informers until caller cancels the context.

func (*Factory) Terminate

func (f *Factory) Terminate()

Terminate terminates all watchers and forwards.

func (*Factory) ValidatePortForwards

func (f *Factory) ValidatePortForwards()

BOZO!! Review!!! ValidatePortForwards check if pods are still around for portforwards.

func (*Factory) WaitForCacheSync

func (f *Factory) WaitForCacheSync()

WaitForCacheSync waits for all factories to update their cache.

type Forwarder

type Forwarder interface {
	// Start starts a port-forward.
	Start(path string, tunnel port.PortTunnel) (*portforward.PortForwarder, error)

	// Stop terminates a port forward.
	Stop()

	// ID returns the pf id.
	ID() string

	// Container returns a container name.
	Container() string

	// Ports returns the port mapping.
	Port() string

	// FQN returns the full port-forward name.
	FQN() string

	// Active returns forwarder current state.
	Active() bool

	// SetActive sets port-forward state.
	SetActive(bool)

	// Age returns forwarder age.
	Age() string

	// HasPortMapping returns true if port mapping exists.
	HasPortMapping(string) bool
}

Forwarder represents a port forwarder.

type Forwarders

type Forwarders map[string]Forwarder

Forwarders tracks active port forwards.

func NewForwarders

func NewForwarders() Forwarders

NewForwarders returns new forwarders.

func (Forwarders) DeleteAll

func (ff Forwarders) DeleteAll()

DeleteAll stops and delete all port-forwards.

func (Forwarders) Dump

func (ff Forwarders) Dump()

Dump for debug!

func (Forwarders) IsContainerForwarded

func (ff Forwarders) IsContainerForwarded(fqn, co string) bool

IsContainerForwarded checks if pod has a forward.

func (Forwarders) IsPodForwarded

func (ff Forwarders) IsPodForwarded(fqn string) bool

BOZO!! Review!!! IsPodForwarded checks if pod has a forward.

func (Forwarders) Kill

func (ff Forwarders) Kill(path string) int

Kill stops and delete a port-forwards associated with pod.

Jump to

Keyboard shortcuts

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