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) 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
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) (*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/resourcei/container. AllocateIP returns subnet details for the requested IP, as defined in IP pool spec.
func (*IPPoolAllocator) HasContainer ¶
func (a *IPPoolAllocator) HasContainer(containerID string) (bool, error)
HasResource checks whether an IP was associated with specified container. It returns error if the resource is 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
ReleaseResource releases the IP associated with specified Pod. It returns error if the resource is not present in state or in case CRD failed to update its state. In case of success, IP pool CRD status is updated with released entry.