Documentation
¶
Index ¶
- Variables
- func CheckNetworkConfig(config *Config) error
- func MakeSubnetKey(sn ip.IP4Net, sn6 ip.IP6Net) string
- func ParseSubnetKey(s string) (*ip.IP4Net, *ip.IP6Net)
- func WatchLease(ctx context.Context, sm Manager, sn ip.IP4Net, sn6 ip.IP6Net, ...)
- func WatchLeases(ctx context.Context, sm Manager, ownLease *Lease, receiver chan []Event)
- func WriteSubnetFile(path string, config *Config, ipMasq bool, sn ip.IP4Net, ipv6sn ip.IP6Net, ...) error
- type Config
- type Event
- type EventType
- type Lease
- type LeaseAttrs
- type LeaseWatchResult
- type Manager
Constants ¶
This section is empty.
Variables ¶
var ( ErrLeaseTaken = errors.New("subnet: lease already taken") ErrNoMoreTries = errors.New("subnet: no more tries") )
Functions ¶
func CheckNetworkConfig ¶
CheckNetworkConfig checks the coherence of the flannel configuration. It is used only with the local network manager, not with the kubernetes-based manager.
func WatchLease ¶
WatchLease performs a long term watch of the given network's subnet lease 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 WatchLeases ¶
WatchLeases performs a long term watch of the given network's subnet leases 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 Config ¶
type Config struct { EnableIPv4 bool EnableIPv6 bool Network ip.IP4Net IPv6Network ip.IP6Net Networks []ip.IP4Net IPv6Networks []ip.IP6Net SubnetMin ip.IP4 SubnetMax ip.IP4 IPv6SubnetMin *ip.IP6 IPv6SubnetMax *ip.IP6 SubnetLen uint IPv6SubnetLen uint BackendType string `json:"-"` Backend json.RawMessage `json:",omitempty"` }
func ParseConfig ¶
func (*Config) AddNetwork ¶
AddNetwork adds net to either c.Networks or c.IPv6Networks depending on its type
func (*Config) GetFlannelIPv6Network ¶
GetFlannelIPv6Network returns the relevant IPv6 network (i.e. clusterCIDR) for subnet sn If Networks is not empty, GetFlannelIPv6Network returns the first networks that contains subnet sn. If Networks is empty, this means we are not using the MultiClusterCIDR API so GetFlannelIPv6Network falls back to the standard behavior and returns the single IPv6Network entry
func (*Config) GetFlannelNetwork ¶
GetFlannelNetwork returns the relevant IPv4 network (i.e. clusterCIDR) for subnet sn If Networks is not empty, GetFlannelNetwork returns the first networks that contains subnet sn. If Networks is empty, this means we are not using the MultiClusterCIDR API so GetFlannelNetwork falls back to the standard behavior and returns the single Network entry
func (*Config) HasIPv6Networks ¶
HasIPv6Networks returns true if there is at least 1 IPv6 network in the flannel config, false otherwise
func (*Config) HasNetworks ¶
HasNetworks returns true if there is at least 1 IPv4 network in the flannel config, false otherwise
type EventType ¶
type EventType int
func (EventType) MarshalJSON ¶
func (*EventType) UnmarshalJSON ¶
type Lease ¶
type LeaseAttrs ¶
type LeaseAttrs struct { PublicIP ip.IP4 PublicIPv6 *ip.IP6 BackendType string `json:",omitempty"` BackendData json.RawMessage `json:",omitempty"` BackendV6Data json.RawMessage `json:",omitempty"` }
type LeaseWatchResult ¶
type LeaseWatchResult 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 []Lease `json:"snapshot"` Cursor interface{} `json:"cursor"` }
type Manager ¶
type Manager interface { GetNetworkConfig(ctx context.Context) (*Config, error) HandleSubnetFile(path string, config *Config, ipMasq bool, sn ip.IP4Net, ipv6sn ip.IP6Net, mtu int) error AcquireLease(ctx context.Context, attrs *LeaseAttrs) (*Lease, error) RenewLease(ctx context.Context, lease *Lease) error WatchLease(ctx context.Context, sn ip.IP4Net, sn6 ip.IP6Net, receiver chan []LeaseWatchResult) error WatchLeases(ctx context.Context, receiver chan []LeaseWatchResult) error CompleteLease(ctx context.Context, lease *Lease, wg *sync.WaitGroup) error Name() string }