Documentation ¶
Index ¶
- Variables
- func IsAlreadyOwnedError(err error) bool
- type BaseSubnetAllocator
- func (sna *BaseSubnetAllocator) AddNetworkRange(network *net.IPNet, hostSubnetLen int) error
- func (sna *BaseSubnetAllocator) AllocateIPv4Network(owner string) (*net.IPNet, error)
- func (sna *BaseSubnetAllocator) AllocateIPv6Network(owner string) (*net.IPNet, error)
- func (sna *BaseSubnetAllocator) AllocateNetworks(owner string) ([]*net.IPNet, error)
- func (sna *BaseSubnetAllocator) Count() (uint64, uint64)
- func (sna *BaseSubnetAllocator) MarkAllocatedNetworks(owner string, subnets ...*net.IPNet) error
- func (sna *BaseSubnetAllocator) ReleaseAllNetworks(owner string)
- func (sna *BaseSubnetAllocator) ReleaseNetworks(owner string, subnets ...*net.IPNet) error
- func (sna *BaseSubnetAllocator) Usage() (uint64, uint64)
- type NodeAllocator
- type SubnetAllocator
Constants ¶
This section is empty.
Variables ¶
var ErrSubnetAllocatorFull = fmt.Errorf("no subnets available")
Functions ¶
func IsAlreadyOwnedError ¶
IsAlreadyOwnedError returns true if the error indicates the network was already owned
Types ¶
type BaseSubnetAllocator ¶
func (*BaseSubnetAllocator) AddNetworkRange ¶
func (sna *BaseSubnetAllocator) AddNetworkRange(network *net.IPNet, hostSubnetLen int) error
AddNetworkRange makes the given range available for allocation and returns nil, or an error on failure.
func (*BaseSubnetAllocator) AllocateIPv4Network ¶
func (sna *BaseSubnetAllocator) AllocateIPv4Network(owner string) (*net.IPNet, error)
AllocateIPv4Network tries to allocate an IPv4 network if there are ranges available
func (*BaseSubnetAllocator) AllocateIPv6Network ¶
func (sna *BaseSubnetAllocator) AllocateIPv6Network(owner string) (*net.IPNet, error)
AllocateIPv6Network tries to allocate an IPv6 network if there are ranges available
func (*BaseSubnetAllocator) AllocateNetworks ¶
func (sna *BaseSubnetAllocator) AllocateNetworks(owner string) ([]*net.IPNet, error)
AllocateNetworks tries to allocate networks in all the ranges available
func (*BaseSubnetAllocator) Count ¶
func (sna *BaseSubnetAllocator) Count() (uint64, uint64)
Count returns the number of available (both used and unused) v4 and v6 subnets
func (*BaseSubnetAllocator) MarkAllocatedNetworks ¶
func (sna *BaseSubnetAllocator) MarkAllocatedNetworks(owner string, subnets ...*net.IPNet) error
MarkAllocatedNetworks will mark the given subnets as already allocated by the given owner. Marking is all-or-nothing; if marking one of the subnets fails then none of them are marked as allocated.
func (*BaseSubnetAllocator) ReleaseAllNetworks ¶
func (sna *BaseSubnetAllocator) ReleaseAllNetworks(owner string)
func (*BaseSubnetAllocator) ReleaseNetworks ¶
func (sna *BaseSubnetAllocator) ReleaseNetworks(owner string, subnets ...*net.IPNet) error
func (*BaseSubnetAllocator) Usage ¶
func (sna *BaseSubnetAllocator) Usage() (uint64, uint64)
Usage returns the number of used/allocated v4 and v6 subnets
type NodeAllocator ¶
type NodeAllocator struct {
// contains filtered or unexported fields
}
NodeAllocator acts on node events handed off by the cluster network controller and does the following:
- allocates subnet from the cluster subnet pool. It also allocates subnets from the hybrid overlay subnet pool if hybrid overlay is enabled. It stores these allocated subnets in the node annotation. Only for the default or layer3 networks.
- stores the network id in each node's annotation.
func NewNodeAllocator ¶
func NewNodeAllocator(networkID int, netInfo util.NetInfo, nodeLister listers.NodeLister, kube kube.Interface, tunnelIDAllocator id.Allocator) *NodeAllocator
func (*NodeAllocator) Cleanup ¶
func (na *NodeAllocator) Cleanup() error
Cleanup the subnet annotations from the node
func (*NodeAllocator) HandleAddUpdateNodeEvent ¶
func (na *NodeAllocator) HandleAddUpdateNodeEvent(node *corev1.Node) error
HandleAddUpdateNodeEvent handles the add or update node event
func (*NodeAllocator) HandleDeleteNode ¶
func (na *NodeAllocator) HandleDeleteNode(node *corev1.Node) error
HandleDeleteNode handles the delete node event
func (*NodeAllocator) Init ¶
func (na *NodeAllocator) Init() error
func (*NodeAllocator) Sync ¶
func (na *NodeAllocator) Sync(nodes []interface{}) error
type SubnetAllocator ¶
type SubnetAllocator interface { AddNetworkRange(network *net.IPNet, hostSubnetLen int) error MarkAllocatedNetworks(string, ...*net.IPNet) error // Usage returns the number of used/allocated v4 and v6 subnets Usage() (uint64, uint64) // Count returns the number available (both used and unused) v4 and v6 subnets Count() (uint64, uint64) AllocateNetworks(string) ([]*net.IPNet, error) AllocateIPv4Network(string) (*net.IPNet, error) AllocateIPv6Network(string) (*net.IPNet, error) // ReleaseNetworks releases the given networks if they are owned by the // given owner ReleaseNetworks(string, ...*net.IPNet) error // ReleaseAllNetworks releases all networks owned by the given owner ReleaseAllNetworks(string) }
func NewSubnetAllocator ¶
func NewSubnetAllocator() SubnetAllocator