func TestServiceAllocNewServiceCIDR(t *testing.T) { … } // A ServiceCIDR can be deleted if there are no orphan IPs or if the existing IPs are contained in other ServiceCIDR // that is not being deleted. // The test starts the apiserver with the range "192.168.0.0/29" // Create Services to fill the range // Creates a new ServiceCIDR cidr1 with the same range as the one defined in the apiserver // Deletes cidr1 object will work since its range is covered by the default ServiceCIDR created by the apiserver flags // Creates a new cidr2 with a different range than cidr1 // Creates a new service so it picks an IPAddress on this range because "192.168.0.0/29" is full at this point // Creates a new cidr3 that contains cidr2 // Deletes cidr2 since it is covered by cidr3 // Tries to delete cidr3 but is blocked since there is an IPAddress // Deletes the Service with the IPAddress blocking the deletion // cidr3 must not exist at this point func TestServiceCIDRDeletion(t *testing.T) { … } func makeServiceCIDR(name, primary, secondary string) *networkingv1beta1.ServiceCIDR { … } func makeService(name string) *v1.Service { … } // returns true of the ServiceCIDRConditionReady is true func isServiceCIDRReady(serviceCIDR *networkingv1beta1.ServiceCIDR) bool { … } func cidrContainsIP(cidr, ip string) bool { … }