@@ -70,6 +70,17 @@ func NewKubernetesIPAM(containerID, ifName string, ipamConf whereaboutstypes.IPA
7070 return k8sIPAM , nil
7171}
7272
73+ // NewKubernetesIPAMWithClient returns a new KubernetesIPAM Client configured to a kubernetes CRD backend
74+ func NewKubernetesIPAMWithClient (containerID , ifName string , ipamConf whereaboutstypes.IPAMConfig , namespace string , kubernetesClient Client ) * KubernetesIPAM {
75+ return & KubernetesIPAM {
76+ Config : ipamConf ,
77+ containerID : containerID ,
78+ IfName : ifName ,
79+ namespace : namespace ,
80+ Client : kubernetesClient ,
81+ }
82+ }
83+
7384// NewKubernetesIPAMWithNamespace returns a new KubernetesIPAM Client configured to a kubernetes CRD backend
7485func NewKubernetesIPAMWithNamespace (containerID , ifName string , ipamConf whereaboutstypes.IPAMConfig , namespace string ) (* KubernetesIPAM , error ) {
7586 k8sIPAM , err := NewKubernetesIPAM (containerID , ifName , ipamConf )
@@ -180,7 +191,7 @@ type KubernetesIPPool struct {
180191
181192// Allocations returns the initially retrieved set of allocations for this pool
182193func (p * KubernetesIPPool ) Allocations () []whereaboutstypes.IPReservation {
183- return toIPReservationList (p .pool .Spec .Allocations , p .firstIP )
194+ return ToIPReservationList (p .pool .Spec .Allocations , p .firstIP )
184195}
185196
186197// Update sets the pool allocated IP list to the given IP reservations
@@ -240,7 +251,7 @@ func (p *KubernetesIPPool) Update(ctx context.Context, reservations []whereabout
240251 return nil
241252}
242253
243- func toIPReservationList (allocations map [string ]whereaboutsv1alpha1.IPAllocation , firstip net.IP ) []whereaboutstypes.IPReservation {
254+ func ToIPReservationList (allocations map [string ]whereaboutsv1alpha1.IPAllocation , firstip net.IP ) []whereaboutstypes.IPReservation {
244255 reservelist := []whereaboutstypes.IPReservation {}
245256 for offset , a := range allocations {
246257 numOffset , err := strconv .ParseInt (offset , 10 , 64 )
0 commit comments