@@ -39,6 +39,7 @@ import (
3939)
4040
4141type AKSMachinePoolSpecInput struct {
42+ MgmtCluster framework.ClusterProxy
4243 Cluster * clusterv1.Cluster
4344 MachinePools []* expv1.MachinePool
4445 WaitIntervals []interface {}
@@ -58,7 +59,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
5859
5960 Byf ("Scaling machine pool %s out" , mp .Name )
6061 framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
61- ClusterProxy : bootstrapClusterProxy ,
62+ ClusterProxy : input . MgmtCluster ,
6263 Cluster : input .Cluster ,
6364 Replicas : ptr .Deref (mp .Spec .Replicas , 0 ) + 1 ,
6465 MachinePools : []* expv1.MachinePool {mp },
@@ -67,7 +68,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
6768
6869 Byf ("Scaling machine pool %s in" , mp .Name )
6970 framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
70- ClusterProxy : bootstrapClusterProxy ,
71+ ClusterProxy : input . MgmtCluster ,
7172 Cluster : input .Cluster ,
7273 Replicas : ptr .Deref (mp .Spec .Replicas , 0 ) - 1 ,
7374 MachinePools : []* expv1.MachinePool {mp },
@@ -79,7 +80,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
7980 switch mp .Spec .Template .Spec .InfrastructureRef .Kind {
8081 case infrav1 .AzureManagedMachinePoolKind :
8182 ammp := & infrav1.AzureManagedMachinePool {}
82- err := bootstrapClusterProxy .GetClient ().Get (ctx , types.NamespacedName {
83+ err := input . MgmtCluster .GetClient ().Get (ctx , types.NamespacedName {
8384 Namespace : mp .Spec .Template .Spec .InfrastructureRef .Namespace ,
8485 Name : mp .Spec .Template .Spec .InfrastructureRef .Name ,
8586 }, ammp )
@@ -90,7 +91,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
9091 }
9192 case infrav1alpha .AzureASOManagedMachinePoolKind :
9293 ammp := & infrav1alpha.AzureASOManagedMachinePool {}
93- err := bootstrapClusterProxy .GetClient ().Get (ctx , types.NamespacedName {
94+ err := input . MgmtCluster .GetClient ().Get (ctx , types.NamespacedName {
9495 Namespace : mp .Spec .Template .Spec .InfrastructureRef .Namespace ,
9596 Name : mp .Spec .Template .Spec .InfrastructureRef .Name ,
9697 }, ammp )
@@ -105,7 +106,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
105106 // mode may not be set in spec. Get the ASO object and check in status.
106107 resource .SetNamespace (ammp .Namespace )
107108 agentPool := & asocontainerservicev1.ManagedClustersAgentPool {}
108- Expect (bootstrapClusterProxy .GetClient ().Get (ctx , client .ObjectKeyFromObject (resource ), agentPool )).To (Succeed ())
109+ Expect (input . MgmtCluster .GetClient ().Get (ctx , client .ObjectKeyFromObject (resource ), agentPool )).To (Succeed ())
109110 if ptr .Deref (agentPool .Status .Mode , "" ) != asocontainerservicev1 .AgentPoolMode_STATUS_System {
110111 isUserPool = true
111112 }
@@ -116,7 +117,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
116117 if isUserPool {
117118 Byf ("Scaling the machine pool %s to zero" , mp .Name )
118119 framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
119- ClusterProxy : bootstrapClusterProxy ,
120+ ClusterProxy : input . MgmtCluster ,
120121 Cluster : input .Cluster ,
121122 Replicas : 0 ,
122123 MachinePools : []* expv1.MachinePool {mp },
@@ -126,7 +127,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
126127
127128 Byf ("Restoring initial replica count for machine pool %s" , mp .Name )
128129 framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
129- ClusterProxy : bootstrapClusterProxy ,
130+ ClusterProxy : input . MgmtCluster ,
130131 Cluster : input .Cluster ,
131132 Replicas : originalReplicas ,
132133 MachinePools : []* expv1.MachinePool {mp },
0 commit comments