conduit

package
v0.10.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	PendingTime = 15 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conduit

type Conduit struct {
	// Should be a unique name
	TargetName string
	// Namespace of the trench
	Namespace string
	Conduit   *ambassadorAPI.Conduit
	// Node name the pod is running on
	NodeName             string
	NetworkServiceClient networkservice.NetworkServiceClient
	Configuration        Configuration
	StreamManager        StreamManager
	NetUtils             networking.Utils
	StreamFactory        StreamFactory
	// contains filtered or unexported fields
}

Conduit implements types.Conduit (/pkg/ambassador/tap/types) Responsible for requesting/closing the NSM Connection to the conduit, managing the streams and configuring the VIPs.

func New

func New(conduit *ambassadorAPI.Conduit,
	targetName string,
	namespace string,
	nodeName string,
	configurationManagerClient nspAPI.ConfigurationManagerClient,
	targetRegistryClient nspAPI.TargetRegistryClient,
	networkServiceClient networkservice.NetworkServiceClient,
	streamRegistry types.Registry,
	netUtils networking.Utils,
	nspEntryTimeout time.Duration) (*Conduit, error)

New is the constructor of Conduit. The constructor will create a new stream factory and a VIP configuration watcher

func (*Conduit) AddStream

func (c *Conduit) AddStream(ctx context.Context, strm *ambassadorAPI.Stream) error

AddStream creates a stream based on its factory and will open it (in another goroutine)

func (*Conduit) Connect

func (c *Conduit) Connect(ctx context.Context) error

Connect requests the connection to NSM and, if success, will open all streams added and watch the VIPs

func (*Conduit) Disconnect

func (c *Conduit) Disconnect(ctx context.Context) error

Disconnect closes the connection from NSM, closes all streams and stop the VIP watcher

func (*Conduit) Equals

func (c *Conduit) Equals(conduit *ambassadorAPI.Conduit) bool

Equals checks if the conduit is equal to the one in parameter

func (*Conduit) GetConduit

func (c *Conduit) GetConduit() *ambassadorAPI.Conduit

func (*Conduit) GetIPs

func (c *Conduit) GetIPs() []string

GetIPs returns the local IPs for this conduit

func (*Conduit) GetStreams

func (c *Conduit) GetStreams() []*ambassadorAPI.Stream

GetStreams returns all streams previously added to this conduit

func (*Conduit) RemoveStream

func (c *Conduit) RemoveStream(ctx context.Context, strm *ambassadorAPI.Stream) error

RemoveStream closes and removes the stream (if existing), and removes it from the stream registry.

func (*Conduit) SetVIPs

func (c *Conduit) SetVIPs(vips []string) error

SetVIPs checks the vips which has to be added or removed

type Configuration

type Configuration interface {
	Watch()
	Stop()
}

type StreamFactory

type StreamFactory interface {
	New(*ambassadorAPI.Stream) (types.Stream, error)
}

The factory gathers common properties to simplify the instanciation of new streams. Mostly useful for the tests.

type StreamManager

type StreamManager interface {
	// AddStream adds the stream to the stream manager, registers it to the
	// stream registry, creates a new stream based on StreamFactory, and open it, if
	// the stream manager is running and if the stream exists in the configuration.
	AddStream(strm *ambassadorAPI.Stream) error
	// RemoveStream removes the stream from the manager, removes it
	// from the stream registry and closes it.
	RemoveStream(context.Context, *ambassadorAPI.Stream) error
	// GetStreams returns the list of streams (opened or not).
	GetStreams() []*ambassadorAPI.Stream
	// Set all streams available in the conduit
	SetStreams([]*nspAPI.Stream)
	// Run open all streams registered and set their
	// status based on the ones available in the conduit.
	Run()
	// Stop closes all streams
	Stop(context.Context) error
}

streamManager is responsible for: - opening/closing streams based of the streams available in the conduit. - Re-opening streams which have been closed by another resource (NSP failures...). - setting the status of the streams

func NewStreamManager

func NewStreamManager(configurationManagerClient nspAPI.ConfigurationManagerClient,
	targetRegistryClient nspAPI.TargetRegistryClient,
	streamRegistry types.Registry,
	streamFactory StreamFactory,
	timeout time.Duration,
	nspEntryTimeout time.Duration) StreamManager

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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