kubernetes/pkg/registry/core/service/ipallocator/cidrallocator.go

type MetaAllocator

type item

var _

// NewMetaAllocator returns an IP allocator that use the IPAddress
// and ServiceCIDR objects to track the assigned IP addresses,
// using an informer cache as storage.
func NewMetaAllocator(
	client networkingv1beta1client.NetworkingV1beta1Interface,
	serviceCIDRInformer networkingv1beta1informers.ServiceCIDRInformer,
	ipAddressInformer networkingv1beta1informers.IPAddressInformer,
	isIPv6 bool,
	bitmapAllocator Interface,
) (*MetaAllocator, error) {}

// newMetaAllocator is used to build the allocator for testing
func newMetaAllocator(client networkingv1beta1client.NetworkingV1beta1Interface,
	serviceCIDRInformer networkingv1beta1informers.ServiceCIDRInformer,
	ipAddressInformer networkingv1beta1informers.IPAddressInformer,
	isIPv6 bool,
	bitmapAllocator Interface,
) *MetaAllocator {}

func (c *MetaAllocator) enqueueServiceCIDR(obj interface{}

func (c *MetaAllocator) deleteServiceCIDR(obj interface{}

func (c *MetaAllocator) run() {}

func (c *MetaAllocator) runWorker() {}

func (c *MetaAllocator) processNextItem() bool {}

// syncAllocators adds new allocators and syncs the ready state of the allocators
// deletion of allocators is handled directly on the event handler.
func (c *MetaAllocator) syncAllocators() error {}

// getAllocator returns any allocator that contains the IP passed as argument.
// if ready is set only an allocator that is ready is returned.
// Allocate operations can work with ANY allocator that is ready, the allocators
// contain references to the IP addresses hence does not matter what allocators have
// the IP. Release operations need to work with ANY allocator independent of its state.
func (c *MetaAllocator) getAllocator(ip net.IP, ready bool) (*Allocator, error) {}

func (c *MetaAllocator) AllocateService(service *api.Service, ip net.IP) error {}

// Allocate attempts to reserve the provided IP. ErrNotInRange or
// ErrAllocated will be returned if the IP is not valid for this range
// or has already been reserved.  ErrFull will be returned if there
// are no addresses left.
// Only for testing, it will fail to create the IPAddress object because
// the Service reference is required.s
func (c *MetaAllocator) Allocate(ip net.IP) error {}

func (c *MetaAllocator) AllocateNextService(service *api.Service) (net.IP, error) {}

// AllocateNext return an IP address that wasn't allocated yet.
// Only for testing, it will fail to create the IPAddress object because
// the Service reference is required
func (c *MetaAllocator) AllocateNext() (net.IP, error) {}

func (c *MetaAllocator) Release(ip net.IP) error {}

func (c *MetaAllocator) ForEach(f func(ip net.IP)) {}

func (c *MetaAllocator) CIDR() net.IPNet {}

func (c *MetaAllocator) IPFamily() api.IPFamily {}

func (c *MetaAllocator) Has(ip net.IP) bool {}

func (c *MetaAllocator) Destroy() {}

// for testing
func (c *MetaAllocator) Used() int {}

// for testing
func (c *MetaAllocator) Free() int {}

func (c *MetaAllocator) EnableMetrics() {}

// DryRun returns a random allocator
func (c *MetaAllocator) DryRun() Interface {}

func isReady(serviceCIDR *networkingv1beta1.ServiceCIDR) bool {}

// Convert netutils.IPFamily to v1.IPFamily
// TODO: consolidate helpers
// copied from pkg/proxy/util/utils.go
func convertToV1IPFamily(ipFamily netutils.IPFamily) v1.IPFamily {}

// isNotContained returns true if the prefix is not contained in any
// of the passed prefixes.
func isNotContained(prefix netip.Prefix, prefixes []netip.Prefix) bool {}