Documentation ¶
Overview ¶
Package poolutil implements utility functions to manage a pool of IP addresses.
Index ¶
- func AddressByNamespacedName(addresses []ipamv1.IPAddress, namespace, name string) *ipamv1.IPAddress
- func AddressStrParses(addressStr string) bool
- func AddressToIPSet(addressStr string) (*netipx.IPSet, error)
- func AddressesOutOfRangeIPSet(inUseAddresses []ipamv1.IPAddress, poolIPSet *netipx.IPSet) (*netipx.IPSet, error)
- func AddressesToIPSet(addresses []string) (*netipx.IPSet, error)
- func FindFreeAddress(poolIPSet *netipx.IPSet, inUseIPSet *netipx.IPSet) (netip.Addr, error)
- func IPSetCount(ipSet *netipx.IPSet) int
- func ListAddressesInUse(ctx context.Context, c client.Reader, namespace string, ...) ([]ipamv1.IPAddress, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressByNamespacedName ¶
func AddressByNamespacedName(addresses []ipamv1.IPAddress, namespace, name string) *ipamv1.IPAddress
AddressByNamespacedName finds a specific ip address by namespace and name in a slice of addresses.
func AddressStrParses ¶
AddressStrParses checks to see that the addresss string is one of a valid single IP address, a hyphonated IP range, or a Prefix.
func AddressToIPSet ¶
AddressToIPSet converts an addresses to an AddressesToIPSet addresses may be specified as individual IPs, CIDR ranges, or hyphenated IP ranges.
func AddressesOutOfRangeIPSet ¶
func AddressesOutOfRangeIPSet(inUseAddresses []ipamv1.IPAddress, poolIPSet *netipx.IPSet) (*netipx.IPSet, error)
AddressesOutOfRangeIPSet returns an IPSet of the inUseAddresses IPs that are not in the poolIPSet.
func AddressesToIPSet ¶
AddressesToIPSet converts an array of addresses to an AddressesToIPSet addresses may be specified as individual IPs, CIDR ranges, or hyphenated IP ranges.
func FindFreeAddress ¶
FindFreeAddress returns the next free IP Address in a range based on a set of existing addresses.
func IPSetCount ¶
IPSetCount returns the number of IPs contained in the given IPSet. This function returns type int, which is much smaller than the possible size of a range, which could be 2^128 IPs. When an IPSet's count is would be larger than an int, math.MaxInt is returned instead.
func ListAddressesInUse ¶
func ListAddressesInUse(ctx context.Context, c client.Reader, namespace string, poolRef corev1.TypedLocalObjectReference) ([]ipamv1.IPAddress, error)
ListAddressesInUse fetches all IPAddresses belonging to the specified pool. Note: requires `index.ipAddressByCombinedPoolRef` to be set up.
Types ¶
This section is empty.