func (r *rangeAllocator) ReleaseCIDR(node *v1.Node) error {
	if node == nil || len(node.Spec.PodCIDRs) == 0 {
		return nil
	}

	for idx, cidr := range node.Spec.PodCIDRs {
		_, podCIDR, err := net.ParseCIDR(cidr)
		if err != nil {
			return fmt.Errorf("failed to parse CIDR %s on Node %v: %v", cidr, node.Name, err)
		}

		// If node has a pre allocate cidr that does not exist in our cidrs.
		// This will happen if cluster went from dualstack(multi cidrs) to non-dualstack
		// then we have now way of locking it
		if idx >= len(r.cidrSets) {
			return fmt.Errorf("node:%s has an allocated cidr: %v at index:%v that does not exist in cluster cidrs configuration", node.Name, cidr, idx)
		}

		klog.V(4).Infof("release CIDR %s for node:%v", cidr, node.Name)
		if err = r.cidrSets[idx].Release(podCIDR); err != nil {
			return fmt.Errorf("error when releasing CIDR %v: %v", cidr, err)
		}
	}
	return nil
}
// ReleaseCIDR marks node.podCIDRs[...] as unused in our tracked cidrSets
ReleaseCIDR marks node.podCIDRs[...] as unused in our tracked cidrSets
// ReleaseCIDR marks node . podCIDRs [ ... ] as unused in our tracked cidrSets
func (r *rangeAllocator) ReleaseCIDR(node *v1.Node) error {
	if node == nil || len(node.Spec.PodCIDRs) == 0 {
		return nil
	}
	for idx, cidr := range node.Spec.PodCIDRs {
		_, podCIDR, err := net.ParseCIDR(cidr)
		if err != nil {
			return fmt.Errorf("failed to parse CIDR %s on Node %v: %v", cidr, node.Name, err)
		}
		if idx >= len(r.cidrSets) {
			return fmt.Errorf("node:%s has an allocated cidr: %v at index:%v that does not exist in cluster cidrs configuration", node.Name, cidr, idx)
		}
		klog.V(4).Infof("release CIDR %s for node:%v", cidr, node.Name)
		if err = r.cidrSets[idx].Release(podCIDR); err != nil {
			return fmt.Errorf("error when releasing CIDR %v: %v", cidr, err)
		}
	}
	return nil
}
func ( r * rangeAllocator ) ReleaseCIDR ( node * v1 . Node ) error { if node == nil || len ( node . Spec . PodCIDRs ) == 0 { return nil } for idx , cidr := range node . Spec . PodCIDRs { _ , podCIDR , err := net . ParseCIDR ( cidr ) if err != nil { return fmt . Errorf ( " " , cidr , node . Name , err ) } if idx >= len ( r . cidrSets ) { return fmt . Errorf ( " " , node . Name , cidr , idx ) } klog . V ( 4 ) . Infof ( " " , cidr , node . Name ) if err = r . cidrSets [ idx ] . Release ( podCIDR ) ; err != nil { return fmt . Errorf ( " " , cidr , err ) } } return nil }
ReleaseCIDR marks node.podCIDRs[...] as unused in our tracked cidrSets
ReleaseCIDR marks node . podCIDRs [ ... ] as unused in our tracked cidrSets
// If node has a pre allocate cidr that does not exist in our cidrs. // This will happen if cluster went from dualstack(multi cidrs) to non-dualstack // then we have now way of locking it