Documentation ¶
Overview ¶
Package ipam contains utility functions to deal with resources of the IPAM API.
Index ¶
- func CreateNetwork(ctx context.Context, cl client.Client, name, namespace, cidr string, ...) error
- func FirstNIPsFromPrefix(prefix netip.Prefix, num uint32) iter.Seq[netip.Addr]
- func GetExternalCIDR(ctx context.Context, cl client.Client) (string, error)
- func GetExternalCIDRNetwork(ctx context.Context, cl client.Client) (*ipamv1alpha1.Network, error)
- func GetInternalCIDR(ctx context.Context, cl client.Client) (string, error)
- func GetInternalCIDRNetwork(ctx context.Context, cl client.Client) (*ipamv1alpha1.Network, error)
- func GetPodCIDR(ctx context.Context, cl client.Client) (string, error)
- func GetPodCIDRNetwork(ctx context.Context, cl client.Client) (*ipamv1alpha1.Network, error)
- func GetRemappedIP(ip *ipamv1alpha1.IP) networkingv1beta1.IP
- func GetReservedSubnetNetworks(ctx context.Context, cl client.Client) ([]ipamv1alpha1.Network, error)
- func GetReservedSubnets(ctx context.Context, cl client.Client) ([]string, error)
- func GetServiceCIDR(ctx context.Context, cl client.Client) (string, error)
- func GetServiceCIDRNetwork(ctx context.Context, cl client.Client) (*ipamv1alpha1.Network, error)
- func GetUnknownSourceIP(extCIDR string) (string, error)
- func IsAPIServerIP(ip *ipamv1alpha1.IP) bool
- func IsAPIServerProxyIP(ip *ipamv1alpha1.IP) bool
- func IsExternalCIDR(nw *ipamv1alpha1.Network) bool
- func IsInternalCIDR(nw *ipamv1alpha1.Network) bool
- func IsPodCIDR(nw *ipamv1alpha1.Network) bool
- func IsReservedNetwork(nw *ipamv1alpha1.Network) bool
- func IsServiceCIDR(nw *ipamv1alpha1.Network) bool
- func NetFirstAndLastIP(networkCIDR string) (first, last net.IP, err error)
- func NetworkNotRemapped(nw *ipamv1alpha1.Network) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNetwork ¶
func CreateNetwork(ctx context.Context, cl client.Client, name, namespace, cidr string, needRemapping bool, networkType *consts.NetworkType) error
CreateNetwork creates a Network resource with the given name and CIDR. NeedRemapping indicates whether the Network needs CIDR remapping from IPAM. NetworkType indicates the type of the Network (leave empty to not set the type).
func FirstNIPsFromPrefix ¶
FirstNIPsFromPrefix returns an iterator with first num IPs from the given prefix.
func GetExternalCIDR ¶
GetExternalCIDR retrieves the externalCIDR of the local cluster.
func GetExternalCIDRNetwork ¶
GetExternalCIDRNetwork retrieves the Network resource of type ExternalCIDR.
func GetInternalCIDR ¶
GetInternalCIDR retrieves the internalCIDR of the local cluster.
func GetInternalCIDRNetwork ¶
GetInternalCIDRNetwork retrieves the Network resource of type InternalCIDR.
func GetPodCIDR ¶
GetPodCIDR retrieves the podCIDR of the local cluster.
func GetPodCIDRNetwork ¶
GetPodCIDRNetwork retrieves the Network resource of type PodCIDR.
func GetRemappedIP ¶
func GetRemappedIP(ip *ipamv1alpha1.IP) networkingv1beta1.IP
GetRemappedIP returns the remapped IP of the given IP resource.
func GetReservedSubnetNetworks ¶
func GetReservedSubnetNetworks(ctx context.Context, cl client.Client) ([]ipamv1alpha1.Network, error)
GetReservedSubnetNetworks retrieves the Network resources of type Reserved.
func GetReservedSubnets ¶
GetReservedSubnets retrieves the reserved subnets of the local cluster.
func GetServiceCIDR ¶
GetServiceCIDR retrieves the serviceCIDR of the local cluster.
func GetServiceCIDRNetwork ¶
GetServiceCIDRNetwork retrieves the Network resource of type ServiceCIDR.
func GetUnknownSourceIP ¶
GetUnknownSourceIP returns the IP address used to map unknown sources.
func IsAPIServerIP ¶
func IsAPIServerIP(ip *ipamv1alpha1.IP) bool
IsAPIServerIP checks if the resource is an IP of type API server.
func IsAPIServerProxyIP ¶
func IsAPIServerProxyIP(ip *ipamv1alpha1.IP) bool
IsAPIServerProxyIP checks if the resource is an IP of type API server proxy.
func IsExternalCIDR ¶
func IsExternalCIDR(nw *ipamv1alpha1.Network) bool
IsExternalCIDR returns whether the given Network is of type ExternalCIDR.
func IsInternalCIDR ¶
func IsInternalCIDR(nw *ipamv1alpha1.Network) bool
IsInternalCIDR returns whether the given Network is of type InternalCIDR.
func IsPodCIDR ¶
func IsPodCIDR(nw *ipamv1alpha1.Network) bool
IsPodCIDR returns whether the given Network is of type PodCIDR.
func IsReservedNetwork ¶
func IsReservedNetwork(nw *ipamv1alpha1.Network) bool
IsReservedNetwork returns whether the given Network is of type Reserved.
func IsServiceCIDR ¶
func IsServiceCIDR(nw *ipamv1alpha1.Network) bool
IsServiceCIDR returns whether the given Network is of type ServiceCIDR.
func NetFirstAndLastIP ¶
NetFirstAndLastIP takes the beginning address of an entire network in CIDR notation (e.g. 192.168.1.0/24) and returns the first and last IP addresses within the network (e.g. first 192.168.1.0, last 192.168.1.255).
Note that these are the first and last IP addresses, not the first and last *usable* IP addresses (which would be 192.168.1.1 and 192.168.1.254, respectively, for 192.168.1.0/24). Note: this is copied from github.com/google/nftables, copyright Google LLC, licensed under the Apache 2.0 license.
func NetworkNotRemapped ¶
func NetworkNotRemapped(nw *ipamv1alpha1.Network) bool
NetworkNotRemapped returns whether the given Network does not need CIDR remapping.
Types ¶
This section is empty.