Documentation ¶
Index ¶
- Constants
- type Conduit
- func (c *Conduit) AddStream(ctx context.Context, strm *ambassadorAPI.Stream) error
- func (c *Conduit) Connect(ctx context.Context) error
- func (c *Conduit) Disconnect(ctx context.Context) error
- func (c *Conduit) Equals(conduit *ambassadorAPI.Conduit) bool
- func (c *Conduit) GetConduit() *ambassadorAPI.Conduit
- func (c *Conduit) GetIPs() []string
- func (c *Conduit) GetStreams() []*ambassadorAPI.Stream
- func (c *Conduit) RemoveStream(ctx context.Context, strm *ambassadorAPI.Stream) error
- func (c *Conduit) SetVIPs(vips []string) error
- type Configuration
- type StreamFactory
- type StreamManager
Constants ¶
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 ¶
AddStream creates a stream based on its factory and will open it (in another goroutine)
func (*Conduit) Connect ¶
Connect requests the connection to NSM and, if success, will open all streams added and watch the VIPs
func (*Conduit) Disconnect ¶
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) GetStreams ¶
func (c *Conduit) GetStreams() []*ambassadorAPI.Stream
GetStreams returns all streams previously added to this conduit
func (*Conduit) RemoveStream ¶
RemoveStream closes and removes the stream (if existing), and removes it from the stream registry.
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