Documentation ¶
Index ¶
- type AddressIterator
- type Allocator
- type AllocatorProvider
- type NoOpAllocator
- func (n *NoOpAllocator) Allocate(poolID types.PoolID, ip net.IP) error
- func (n *NoOpAllocator) AllocateMany(poolID types.PoolID, num int) ([]net.IP, error)
- func (n *NoOpAllocator) FirstPoolWithAvailableQuota(preferredPoolIDs []types.PoolID) (types.PoolID, int)
- func (n *NoOpAllocator) GetPoolQuota() types.PoolQuotaMap
- func (n *NoOpAllocator) PoolExists(poolID types.PoolID) bool
- func (n *NoOpAllocator) ReleaseMany(poolID types.PoolID, ips []net.IP) error
- type NodeEventHandler
- type PoolAllocator
- type PoolGroupAllocator
- func (g *PoolGroupAllocator) Allocate(poolID types.PoolID, ip net.IP) error
- func (g *PoolGroupAllocator) AllocateMany(poolID types.PoolID, num int) ([]net.IP, error)
- func (g *PoolGroupAllocator) FirstPoolWithAvailableQuota(preferredPoolIDs []types.PoolID) (types.PoolID, int)
- func (g *PoolGroupAllocator) GetPoolQuota() types.PoolQuotaMap
- func (g *PoolGroupAllocator) PoolExists(poolID types.PoolID) bool
- func (g *PoolGroupAllocator) ReleaseMany(poolID types.PoolID, ips []net.IP) error
- func (g *PoolGroupAllocator) ReserveAddresses(iterator AddressIterator)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressIterator ¶ added in v1.8.0
type AddressIterator interface {
ForeachAddress(instanceID string, fn types.AddressIterator) error
}
AddressIterator is the required interface to allow iterating over a structure which holds a set of addresses
type Allocator ¶ added in v1.8.0
type Allocator interface { GetPoolQuota() types.PoolQuotaMap FirstPoolWithAvailableQuota(preferredPoolIDs []types.PoolID) (types.PoolID, int) PoolExists(poolID types.PoolID) bool Allocate(poolID types.PoolID, ip net.IP) error AllocateMany(poolID types.PoolID, num int) ([]net.IP, error) ReleaseMany(poolID types.PoolID, ips []net.IP) error }
Allocator provides an IP allocator based on a list of Pools
Implementations:
- PoolGroupAllocator
- NoOpAllocator
type AllocatorProvider ¶
type AllocatorProvider interface { Init(ctx context.Context) error Start(getterUpdater ipam.CiliumNodeGetterUpdater) (NodeEventHandler, error) }
AllocatorProvider defines the functions of IPAM provider front-end these are implemented by e.g. pkg/ipam/allocator/{aws,azure}.
type NoOpAllocator ¶ added in v1.8.0
type NoOpAllocator struct{}
NoOpAllocator implements Allocator with no-op behavior
func (*NoOpAllocator) Allocate ¶ added in v1.8.0
Allocate allocates a paritcular IP in a particular pool. This function always returns an error as this operation is not supported for the no-op allocator.
func (*NoOpAllocator) AllocateMany ¶ added in v1.8.0
AllocateMany allocates multiple IP addresses. The operation succeeds if all IPs can be allocated. On failure, all IPs are released again.
func (*NoOpAllocator) FirstPoolWithAvailableQuota ¶ added in v1.8.0
func (n *NoOpAllocator) FirstPoolWithAvailableQuota(preferredPoolIDs []types.PoolID) (types.PoolID, int)
FirstPoolWithAvailableQuota returns the first pool ID in the list of pools with available addresses. This function always returns types.PoolNotExists
func (*NoOpAllocator) GetPoolQuota ¶ added in v1.8.0
func (n *NoOpAllocator) GetPoolQuota() types.PoolQuotaMap
GetPoolQuota returns the total available pool quota. This is always 0.
func (*NoOpAllocator) PoolExists ¶ added in v1.8.0
func (n *NoOpAllocator) PoolExists(poolID types.PoolID) bool
PoolExists returns true if an allocation pool exists. This function always returns false.
func (*NoOpAllocator) ReleaseMany ¶ added in v1.8.0
ReleaseMany releases a slice of IP addresses. This function has no effect
type NodeEventHandler ¶
type NodeEventHandler interface { Create(resource *v2.CiliumNode) bool Update(resource *v2.CiliumNode) bool Delete(nodeName string) Resync(context.Context, time.Time) }
NodeEventHandler should implement the behavior to handle CiliumNode
type PoolAllocator ¶ added in v1.8.0
type PoolAllocator struct { PoolID types.PoolID AllocationCIDR *cidr.CIDR // contains filtered or unexported fields }
PoolAllocator is an IP allocator allocating out of a particular CIDR pool
func NewPoolAllocator ¶ added in v1.8.0
NewPoolAllocator returns a new Allocator
func (*PoolAllocator) Allocate ¶ added in v1.8.0
func (s *PoolAllocator) Allocate(ip net.IP) error
Allocate allocates a particular IP
func (*PoolAllocator) AllocateMany ¶ added in v1.8.0
func (s *PoolAllocator) AllocateMany(num int) ([]net.IP, error)
AllocateMany allocates multiple IP addresses. The operation succeeds if all IPs can be allocated. On failure, all IPs are released again.
func (*PoolAllocator) Free ¶ added in v1.8.0
func (s *PoolAllocator) Free() int
Free returns the number of available IPs for allocation
func (*PoolAllocator) ReleaseMany ¶ added in v1.8.0
func (s *PoolAllocator) ReleaseMany(ips []net.IP)
ReleaseMany releases a slice of IP addresses
type PoolGroupAllocator ¶ added in v1.8.0
type PoolGroupAllocator struct {
// contains filtered or unexported fields
}
PoolGroupAllocator is an allocator to allocate from a group of subnets
func NewPoolGroupAllocator ¶ added in v1.8.0
func NewPoolGroupAllocator(subnets types.SubnetMap) (*PoolGroupAllocator, error)
NewPoolGroupAllocator returns a new allocator able to allocate out of a group of pools.
func (*PoolGroupAllocator) Allocate ¶ added in v1.8.0
Allocate allocates a paritcular IP in a particular pool
func (*PoolGroupAllocator) AllocateMany ¶ added in v1.8.0
AllocateMany allocates multiple IP addresses. The operation succeeds if all IPs can be allocated. On failure, all IPs are released again.
func (*PoolGroupAllocator) FirstPoolWithAvailableQuota ¶ added in v1.8.0
func (g *PoolGroupAllocator) FirstPoolWithAvailableQuota(preferredPoolIDs []types.PoolID) (types.PoolID, int)
FirstPoolWithAvailableQuota returns the first pool ID in the list of pools with available addresses. If any of the preferred pool IDs have available addresses, the first pool in that list is returned.
func (*PoolGroupAllocator) GetPoolQuota ¶ added in v1.8.0
func (g *PoolGroupAllocator) GetPoolQuota() types.PoolQuotaMap
GetPoolQuota returns the number of available IPs in all IP pools
func (*PoolGroupAllocator) PoolExists ¶ added in v1.8.0
func (g *PoolGroupAllocator) PoolExists(poolID types.PoolID) bool
PoolExists returns true if an allocation pool exists.
func (*PoolGroupAllocator) ReleaseMany ¶ added in v1.8.0
ReleaseMany releases a slice of IP addresses. This function has no effect
func (*PoolGroupAllocator) ReserveAddresses ¶ added in v1.8.0
func (g *PoolGroupAllocator) ReserveAddresses(iterator AddressIterator)
ReserveAddresses reserves all addresses returned by an AddressIterator. Invalid IPs or failures to allocate are logged