@@ -38,6 +38,7 @@ import (
38
38
"k8s.io/client-go/rest"
39
39
"k8s.io/client-go/tools/clientcmd"
40
40
"k8s.io/client-go/tools/clientcmd/api"
41
+ infrav1 "sigs.k8s.io/cluster-api-provider-packet/api/v1beta1"
41
42
"sigs.k8s.io/cluster-api-provider-packet/pkg/cloud/packet"
42
43
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
43
44
"sigs.k8s.io/cluster-api/test/framework"
@@ -191,6 +192,19 @@ func (w *wrappedClusterProxy) isDockerCluster(ctx context.Context, namespace str
191
192
return cluster .Spec .InfrastructureRef .Kind == "DockerCluster"
192
193
}
193
194
195
+ func (w * wrappedClusterProxy ) isEMLBCluster (ctx context.Context , namespace string , name string ) bool {
196
+ cl := w .GetClient ()
197
+
198
+ packetCluster := & infrav1.PacketCluster {}
199
+ key := client.ObjectKey {
200
+ Name : name ,
201
+ Namespace : namespace ,
202
+ }
203
+ Expect (cl .Get (ctx , key , packetCluster )).To (Succeed (), "Failed to get %s" , key )
204
+
205
+ return packetCluster .Spec .VIPManager == "EMLB"
206
+ }
207
+
194
208
func (w * wrappedClusterProxy ) getKubeconfig (ctx context.Context , namespace string , name string ) * api.Config {
195
209
cl := w .GetClient ()
196
210
@@ -358,8 +372,10 @@ func (wc *wrappedClient) List(ctx context.Context, list client.ObjectList, opts
358
372
359
373
if cl , ok := list .(* clusterv1.ClusterList ); ok {
360
374
for _ , c := range cl .Items {
361
- logf ("Recording cluster %s for EIP Cleanup later" , c .GetName ())
362
- wc .clusterProxy .clusterNames .Insert (c .GetName ())
375
+ if ! wc .clusterProxy .isEMLBCluster (ctx , c .Namespace , c .GetName ()) {
376
+ logf ("Recording cluster %s for EIP Cleanup later" , c .GetName ())
377
+ wc .clusterProxy .clusterNames .Insert (c .GetName ())
378
+ }
363
379
}
364
380
}
365
381
0 commit comments