poolallocator

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPPoolAllocator

type IPPoolAllocator struct {
	// IP version of the IPPool
	IPVersion v1alpha2.IPVersion
	// contains filtered or unexported fields
}

IPPoolAllocator is responsible for allocating IPs from IP set defined in IPPool CRD. The will update CRD usage accordingly. Pool Allocator assumes that pool with allocated IPs can not be deleted. Pool ranges can only be extended.

func NewIPPoolAllocator

func NewIPPoolAllocator(poolName string, client crdclientset.Interface, poolLister informers.IPPoolLister) (*IPPoolAllocator, error)

NewIPPoolAllocator creates an IPPoolAllocator based on the provided IP pool.

func (*IPPoolAllocator) AllocateIP

AllocateIP allocates the specified IP. It returns error if the IP is not in the range or already allocated, or in case CRD failed to update its state. In case of success, IP pool CRD status is updated with allocated IP/state/resource/container. AllocateIP returns subnet details for the requested IP, as defined in IP pool spec.

func (*IPPoolAllocator) AllocateNext

AllocateNext allocates the next available IP. It returns error if pool is exausted, or in case CRD failed to update its state. In case of success, IPPool CRD status is updated with allocated IP/state/resource/container. AllocateIP returns subnet details for the requested IP, as defined in IP pool spec.

func (*IPPoolAllocator) AllocateReservedOrNext added in v1.5.0

func (a *IPPoolAllocator) AllocateReservedOrNext(state v1alpha2.IPAddressPhase, owner v1alpha2.IPAddressOwner) (net.IP, *v1alpha2.SubnetInfo, error)

AllocateReservedOrNext allocates the reserved IP if it exists, else allocates next available IP. It returns error if pool is exhausted, or in case it fails to update IPPool's state. In case of success, IP pool status is updated with allocated IP/state/resource/container. AllocateReservedOrNext returns subnet details for the requested IP, as defined in IP pool spec.

func (*IPPoolAllocator) AllocateStatefulSet added in v1.5.0

func (a *IPPoolAllocator) AllocateStatefulSet(namespace, name string, size int) error

AllocateStatefulSet pre-allocates continuous range of IPs for StatefulSet. This functionality is useful when StatefulSet does not have a dedicated IP Pool assigned. It returns error if such range is not available. In this case IPs for the StatefulSet will be allocated on the fly, and there is no guarantee for continuous IPs.

func (*IPPoolAllocator) GetContainerIP added in v1.7.0

func (a *IPPoolAllocator) GetContainerIP(containerID, ifName string) (net.IP, error)

GetContainerIP returns the IP allocated for the container interface if found.

func (*IPPoolAllocator) Release

func (a *IPPoolAllocator) Release(ip net.IP) error

Release releases the provided IP. It returns error if the IP is not in the range or not allocated, or in case CRD failed to update its state. In case of success, IP pool CRD status is updated with released IP/state/resource.

func (*IPPoolAllocator) ReleaseContainer added in v1.7.0

func (a *IPPoolAllocator) ReleaseContainer(containerID, ifName string) error

ReleaseContainer releases the IP associated with the specified container ID and interface name, and updates the IPPool CR status. If no IP is allocated to the Pod according to the IPPool CR status, the func just returns with no change.

func (*IPPoolAllocator) ReleaseStatefulSet added in v1.5.0

func (a *IPPoolAllocator) ReleaseStatefulSet(namespace, name string) error

ReleaseStatefulSet releases all IPs associated with specified StatefulSet. It returns error in case CRD failed to update its state. In case of success, IP pool CRD status is updated with released entries.

func (IPPoolAllocator) Total added in v1.6.0

func (a IPPoolAllocator) Total() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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