type rangeAllocator … var _ … // NewCIDRRangeAllocator returns a CIDRAllocator to allocate CIDRs for node (one from each of clusterCIDRs) // Caller must ensure subNetMaskSize is not less than cluster CIDR mask size. // Caller must always pass in a list of existing nodes so the new allocator. // Caller must ensure that ClusterCIDRs are semantically correct e.g (1 for non DualStack, 2 for DualStack etc..) // can initialize its CIDR map. NodeList is only nil in testing. func NewCIDRRangeAllocator(ctx context.Context, client clientset.Interface, nodeInformer informers.NodeInformer, allocatorParams CIDRAllocatorParams, nodeList *v1.NodeList) (CIDRAllocator, error) { … } func (r *rangeAllocator) Run(ctx context.Context) { … } // runWorker is a long-running function that will continually call the // processNextWorkItem function in order to read and process a message on the // queue. func (r *rangeAllocator) runWorker(ctx context.Context) { … } // processNextWorkItem will read a single work item off the queue and // attempt to process it, by calling the syncHandler. func (r *rangeAllocator) processNextNodeWorkItem(ctx context.Context) bool { … } func (r *rangeAllocator) syncNode(ctx context.Context, key string) error { … } // marks node.PodCIDRs[...] as used in allocator's tracked cidrSet func (r *rangeAllocator) occupyCIDRs(node *v1.Node) error { … } // WARNING: If you're adding any return calls or defer any more work from this // function you have to make sure to update nodesInProcessing properly with the // disposition of the node when the work is done. func (r *rangeAllocator) AllocateOrOccupyCIDR(ctx context.Context, node *v1.Node) error { … } // ReleaseCIDR marks node.podCIDRs[...] as unused in our tracked cidrSets func (r *rangeAllocator) ReleaseCIDR(logger klog.Logger, node *v1.Node) error { … } // Marks all CIDRs with subNetMaskSize that belongs to serviceCIDR as used across all cidrs // so that they won't be assignable. func (r *rangeAllocator) filterOutServiceRange(logger klog.Logger, serviceCIDR *net.IPNet) { … } // updateCIDRsAllocation assigns CIDR to Node and sends an update to the API server. func (r *rangeAllocator) updateCIDRsAllocation(ctx context.Context, nodeName string, allocatedCIDRs []*net.IPNet) error { … }