Documentation ¶
Index ¶
- type IPPoolAllocator
- func (a *IPPoolAllocator) AllocateIP(ip net.IP, state v1alpha2.IPAddressPhase, owner v1alpha2.IPAddressOwner) (v1alpha2.SubnetInfo, error)
- func (a *IPPoolAllocator) AllocateNext(state v1alpha2.IPAddressPhase, owner v1alpha2.IPAddressOwner) (net.IP, v1alpha2.SubnetInfo, error)
- func (a *IPPoolAllocator) AllocateReservedOrNext(state v1alpha2.IPAddressPhase, owner v1alpha2.IPAddressOwner) (net.IP, v1alpha2.SubnetInfo, error)
- func (a *IPPoolAllocator) AllocateStatefulSet(namespace, name string, size int) error
- func (a *IPPoolAllocator) HasContainer(containerID string) (bool, error)
- func (a *IPPoolAllocator) HasPod(namespace, podName string) (bool, error)
- func (a *IPPoolAllocator) Release(ip net.IP) error
- func (a *IPPoolAllocator) ReleaseContainerIfPresent(containerID string) error
- func (a *IPPoolAllocator) ReleasePod(namespace, podName string) error
- func (a *IPPoolAllocator) ReleaseStatefulSet(namespace, name string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPPoolAllocator ¶
type IPPoolAllocator struct {
// 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 ¶
func (a *IPPoolAllocator) AllocateIP(ip net.IP, state v1alpha2.IPAddressPhase, owner v1alpha2.IPAddressOwner) (v1alpha2.SubnetInfo, error)
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 ¶
func (a *IPPoolAllocator) AllocateNext(state v1alpha2.IPAddressPhase, owner v1alpha2.IPAddressOwner) (net.IP, v1alpha2.SubnetInfo, error)
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, 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) 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) HasContainer ¶
func (a *IPPoolAllocator) HasContainer(containerID string) (bool, error)
HasContainer checks whether an IP was associated with specified container. It returns error if the resource crd fails to be retrieved.
func (*IPPoolAllocator) HasPod ¶
func (a *IPPoolAllocator) HasPod(namespace, podName string) (bool, error)
HasResource checks whether an IP was associated with specified pod. It returns error if the resource is crd fails to be retrieved.
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) ReleaseContainerIfPresent ¶
func (a *IPPoolAllocator) ReleaseContainerIfPresent(containerID string) error
ReleaseContainerIfPresent releases the IP associated with specified container ID if present in state. It returns error in case CRD failed to update its state, or if pool does not exist. In case of success, IP pool CRD status is updated with released entry.
func (*IPPoolAllocator) ReleasePod ¶
func (a *IPPoolAllocator) ReleasePod(namespace, podName string) error
ReleasePod releases the IP associated with specified Pod. It returns error if the pod is not present in state or in case CRD failed to update state. In case of success, IP pool CRD status is updated with released entry.
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.