Documentation
¶
Index ¶
- func RunNetnsWatch(ctx context.Context, sm EtcdManager, network string, receiver chan []Event, ...)
- func RunSubnetWatch(ctx context.Context, sm EtcdManager, network string, receiver chan []Event, ...)
- func WatchNetNamespaces(ctx context.Context, sm EtcdManager, network string, receiver chan []Event)
- func WatchSubnets(ctx context.Context, sm EtcdManager, network string, receiver chan []Event)
- type ClusterNetwork
- type EtcdManager
- type Event
- type EventType
- type HostSubnet
- type Lease
- type NetNamespace
- type NetNamespaceWatchResult
- type NetworkWatchResult
- type SubnetWatchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunNetnsWatch ¶
func RunSubnetWatch ¶
func WatchNetNamespaces ¶
func WatchNetNamespaces(ctx context.Context, sm EtcdManager, network string, receiver chan []Event)
WatchNetNamespaces performs a long term watch of the given network's netnamespaces and communicates addition/deletion events on receiver channel. It takes care of handling "fall-behind" logic where the history window has advanced too far and it needs to diff the latest snapshot with its saved state and generate events
func WatchSubnets ¶
func WatchSubnets(ctx context.Context, sm EtcdManager, network string, receiver chan []Event)
WatchSubnets performs a long term watch of the given network's subnets and communicates addition/deletion events on receiver channel. It takes care of handling "fall-behind" logic where the history window has advanced too far and it needs to diff the latest snapshot with its saved state and generate events
Types ¶
type ClusterNetwork ¶
type EtcdManager ¶
type EtcdManager interface { GetNetworkConfig(ctx context.Context, network string) (*ClusterNetwork, error) AcquireSubnet(ctx context.Context, network string, host string, subnet *HostSubnet) error GetSubnet(ctx context.Context, network string, host string) (*HostSubnet, error) GetNetNamespace(ctx context.Context, network string, namespace string) (*NetNamespace, error) GetSubnets(ctx context.Context, network string) ([]HostSubnet, error) GetNetNamespaces(ctx context.Context, network string) ([]NetNamespace, error) AcquireNetNamespace(ctx context.Context, network string, attrs *NetNamespace) error RenewSubnet(ctx context.Context, network string, subnet *HostSubnet) error RenewNetNamespace(ctx context.Context, network string, netns *NetNamespace) error RevokeSubnet(ctx context.Context, network string, host string) error RevokeNetNamespace(ctx context.Context, network string, namespace string) error WatchSubnets(ctx context.Context, network string, cursor interface{}) (SubnetWatchResult, error) WatchNetNamespaces(ctx context.Context, network string, cursor interface{}) (NetNamespaceWatchResult, error) }
type Event ¶
type Event struct { Type EventType `json:"type"` Subnet HostSubnet `json:"hostsubnet,omitempty"` Network string `json:"network,omitempty"` NetNS NetNamespace `json:"netnamespace,omitempty"` }
type HostSubnet ¶
type HostSubnet struct { // host may just be an IP address, resolvable hostname or a complete DNS Host string HostIP string Subnet string Assign bool }
HostSubnet encapsulates the inputs needed to define the container subnet network on a node
type NetNamespace ¶
NetNamespace holds the network id against its name
type NetNamespaceWatchResult ¶
type NetNamespaceWatchResult struct { // Either Events or Snapshot will be set. If Events is empty, it means // the cursor was out of range and Snapshot contains the current list // of items, even if empty. Events []Event `json:"events"` Snapshot []NetNamespace `json:"snapshot"` Cursor interface{} `json:"cursor"` }
type NetworkWatchResult ¶
type NetworkWatchResult struct { // Either Events or Snapshot will be set. If Events is empty, it means // the cursor was out of range and Snapshot contains the current list // of items, even if empty. Events []Event `json:"events"` Snapshot []string `json:"snapshot"` Cursor interface{} `json:"cursor,omitempty"` }
type SubnetWatchResult ¶
type SubnetWatchResult struct { // Either Events or Snapshot will be set. If Events is empty, it means // the cursor was out of range and Snapshot contains the current list // of items, even if empty. Events []Event `json:"events"` Snapshot []HostSubnet `json:"snapshot"` Cursor interface{} `json:"cursor"` }