@@ -21,7 +21,6 @@ import (
2121
2222 "k8s.io/apimachinery/pkg/util/wait"
2323 klog "k8s.io/klog/v2"
24- "k8s.io/utils/ptr"
2524)
2625
2726// +kubebuilder:rbac:groups=ipam.liqo.io,resources=ips,verbs=get;list;watch
@@ -61,15 +60,14 @@ func (lipam *LiqoIPAM) syncNetworks(ctx context.Context, expiredThreshold time.T
6160
6261 // Create a set for faster lookup.
6362 nwSet := make (map [string ]struct {})
64- for i := range nets {
65- nwI := networkInfo {cidr : nets [i ]}
66- nwSet [nwI .String ()] = struct {}{}
63+ for _ , net := range nets {
64+ nwSet [net ] = struct {}{}
6765 }
6866
6967 // Remove networks that are present in the cache but not in the cluster, and were added before the threshold.
7068 for key := range lipam .cacheNetworks {
7169 if _ , ok := nwSet [key ]; ! ok && lipam .cacheNetworks [key ].creationTimestamp .Before (expiredThreshold ) {
72- lipam .freeNetwork (ptr . To ( lipam .cacheNetworks [key ]) )
70+ lipam .freeNetwork (lipam .cacheNetworks [key ]. cidr )
7371 }
7472 }
7573
@@ -85,15 +83,14 @@ func (lipam *LiqoIPAM) syncIPs(ctx context.Context, expiredThreshold time.Time)
8583
8684 // Create a set for faster lookup.
8785 ipSet := make (map [string ]struct {})
88- for i := range ips {
89- ipI := ipInfo {ipCidr : ips [i ]}
90- ipSet [ipI .String ()] = struct {}{}
86+ for _ , ip := range ips {
87+ ipSet [ip .String ()] = struct {}{}
9188 }
9289
9390 // Remove IPs that are present in the cache but not in the cluster, and were added before the threshold.
9491 for key := range lipam .cacheIPs {
9592 if _ , ok := ipSet [key ]; ! ok && lipam .cacheIPs [key ].creationTimestamp .Before (expiredThreshold ) {
96- lipam .freeIP (ptr . To ( lipam .cacheIPs [key ]) )
93+ lipam .freeIP (lipam .cacheIPs [key ]. ipCidr )
9794 }
9895 }
9996
0 commit comments