allocator

package
v1.14.0-snapshot.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 14 Imported by: 5

Documentation

Index

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
	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(ctx context.Context, 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

func (n *NoOpAllocator) Allocate(poolID types.PoolID, ip net.IP) error

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

func (n *NoOpAllocator) AllocateMany(poolID types.PoolID, 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 (*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) ReleaseMany added in v1.8.0

func (n *NoOpAllocator) ReleaseMany(poolID types.PoolID, ips []net.IP) error

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(resource *v2.CiliumNode)
	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

func NewPoolAllocator(poolID types.PoolID, allocationCIDR *cidr.CIDR) (*PoolAllocator, error)

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

func (g *PoolGroupAllocator) Allocate(poolID types.PoolID, ip net.IP) error

Allocate allocates a paritcular IP in a particular pool

func (*PoolGroupAllocator) AllocateMany added in v1.8.0

func (g *PoolGroupAllocator) AllocateMany(poolID types.PoolID, 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 (*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) ReleaseMany added in v1.8.0

func (g *PoolGroupAllocator) ReleaseMany(poolID types.PoolID, ips []net.IP) error

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL