allocator

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoFreeRanges = errors.New("no free IP ranges available")

Functions

This section is empty.

Types

type AllocatedRange added in v0.1.0

type AllocatedRange struct {
	StartIP net.IP
	EndIP   net.IP
}

AllocatedRange contains range of IPs allocated for the node

type AllocationConfig

type AllocationConfig struct {
	PoolName         string
	Subnet           *net.IPNet
	Gateway          net.IP
	PerNodeBlockSize int
	NodeSelector     *corev1.NodeSelector
}

AllocationConfig contains configuration of the IP pool

func (*AllocationConfig) Equal

func (pc *AllocationConfig) Equal(other *AllocationConfig) bool

type PoolAllocator added in v0.1.0

type PoolAllocator struct {
	// contains filtered or unexported fields
}

PoolAllocator contains pool settings and related allocations

func CreatePoolAllocatorFromIPPool added in v0.1.0

func CreatePoolAllocatorFromIPPool(ctx context.Context,
	p *ipamv1alpha1.IPPool, nodes sets.Set[string]) *PoolAllocator

CreatePoolAllocatorFromIPPool creates a PoolAllocator and load data from the IPPool CR the nodes Set contains the nodes that match the current NodeSelector of the IPPool it is used to filter out Allocations that are not relevant anymore

func (*PoolAllocator) AllocateFromPool added in v0.1.0

func (pa *PoolAllocator) AllocateFromPool(ctx context.Context, node string) (*AllocatedRange, error)

AllocateFromPool allocates a new range in the poolAllocator or return existing one, returns ErrNoFreeRanges if no free ranges available

func (*PoolAllocator) Deallocate added in v0.1.0

func (pa *PoolAllocator) Deallocate(ctx context.Context, node string)

Deallocate remove info about allocation for the node from the poolAllocator

Jump to

Keyboard shortcuts

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