Documentation ¶
Index ¶
- type Connection
- type ConnectionPool
- func (cp *ConnectionPool) Delete(key string)
- func (cp *ConnectionPool) GetByNodeID(driverName, nodeID string) map[string]*Connection
- func (cp *ConnectionPool) GetLeaderByDriver(ctx context.Context, reconciler client.Client, driverName string) (*Connection, error)
- func (cp *ConnectionPool) Put(key string, conn *Connection)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { Client *grpc.ClientConn Capabilities []*identity.Capability Namespace string Name string NodeID string DriverName string Timeout time.Duration }
Connection struct consists of to NodeID, DriverName, Capabilities for the controller to pick sidecar connection and grpc Client to connect to the sidecar.
func NewConnection ¶
func NewConnection(ctx context.Context, endpoint, nodeID, driverName, namespace, podName string) (*Connection, error)
NewConnection establishes connection with sidecar, fetches capability and returns Connection object filled with required information.
func (*Connection) Close ¶
func (c *Connection) Close()
func (*Connection) HasControllerService ¶ added in v0.8.0
func (c *Connection) HasControllerService() bool
type ConnectionPool ¶
type ConnectionPool struct {
// contains filtered or unexported fields
}
ConnectionPool consists of map of Connection objects and methods Put, Get & Delete which operates with required rw locks to ensure consistency. CSIAddonsNode controller will use Put and Delete methods whereas other controllers will make use of Get to choose and connect to sidecar.
func NewConnectionPool ¶
func NewConnectionPool() *ConnectionPool
NewConntionPool initializes and returns ConnectionPool object.
func (*ConnectionPool) Delete ¶
func (cp *ConnectionPool) Delete(key string)
Delete deletes connection object corresponding to given key.
func (*ConnectionPool) GetByNodeID ¶
func (cp *ConnectionPool) GetByNodeID(driverName, nodeID string) map[string]*Connection
GetByNodeID returns map of connections, filtered with given driverName and optional nodeID.
func (*ConnectionPool) GetLeaderByDriver ¶ added in v0.8.0
func (cp *ConnectionPool) GetLeaderByDriver(ctx context.Context, reconciler client.Client, driverName string) (*Connection, error)
GetLeaderByDriver finds the holder of the lease for the driver, and returns the connection to that particular CSI-Addons sidecar.
func (*ConnectionPool) Put ¶
func (cp *ConnectionPool) Put(key string, conn *Connection)
Put adds connection object into map.