@@ -38,6 +38,7 @@ import (
38
38
)
39
39
40
40
type AKSMachinePoolSpecInput struct {
41
+ MgmtCluster framework.ClusterProxy
41
42
Cluster * clusterv1.Cluster
42
43
MachinePools []* expv1.MachinePool
43
44
WaitIntervals []interface {}
@@ -57,7 +58,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
57
58
58
59
Byf ("Scaling machine pool %s out" , mp .Name )
59
60
framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
60
- ClusterProxy : bootstrapClusterProxy ,
61
+ ClusterProxy : input . MgmtCluster ,
61
62
Cluster : input .Cluster ,
62
63
Replicas : ptr .Deref (mp .Spec .Replicas , 0 ) + 1 ,
63
64
MachinePools : []* expv1.MachinePool {mp },
@@ -66,7 +67,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
66
67
67
68
Byf ("Scaling machine pool %s in" , mp .Name )
68
69
framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
69
- ClusterProxy : bootstrapClusterProxy ,
70
+ ClusterProxy : input . MgmtCluster ,
70
71
Cluster : input .Cluster ,
71
72
Replicas : ptr .Deref (mp .Spec .Replicas , 0 ) - 1 ,
72
73
MachinePools : []* expv1.MachinePool {mp },
@@ -78,7 +79,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
78
79
switch mp .Spec .Template .Spec .InfrastructureRef .Kind {
79
80
case infrav1 .AzureManagedMachinePoolKind :
80
81
ammp := & infrav1.AzureManagedMachinePool {}
81
- err := bootstrapClusterProxy .GetClient ().Get (ctx , types.NamespacedName {
82
+ err := input . MgmtCluster .GetClient ().Get (ctx , types.NamespacedName {
82
83
Namespace : mp .Spec .Template .Spec .InfrastructureRef .Namespace ,
83
84
Name : mp .Spec .Template .Spec .InfrastructureRef .Name ,
84
85
}, ammp )
@@ -89,7 +90,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
89
90
}
90
91
case infrav1 .AzureASOManagedMachinePoolKind :
91
92
ammp := & infrav1.AzureASOManagedMachinePool {}
92
- err := bootstrapClusterProxy .GetClient ().Get (ctx , types.NamespacedName {
93
+ err := input . MgmtCluster .GetClient ().Get (ctx , types.NamespacedName {
93
94
Namespace : mp .Spec .Template .Spec .InfrastructureRef .Namespace ,
94
95
Name : mp .Spec .Template .Spec .InfrastructureRef .Name ,
95
96
}, ammp )
@@ -104,7 +105,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
104
105
// mode may not be set in spec. Get the ASO object and check in status.
105
106
resource .SetNamespace (ammp .Namespace )
106
107
agentPool := & asocontainerservicev1.ManagedClustersAgentPool {}
107
- Expect (bootstrapClusterProxy .GetClient ().Get (ctx , client .ObjectKeyFromObject (resource ), agentPool )).To (Succeed ())
108
+ Expect (input . MgmtCluster .GetClient ().Get (ctx , client .ObjectKeyFromObject (resource ), agentPool )).To (Succeed ())
108
109
if ptr .Deref (agentPool .Status .Mode , "" ) != asocontainerservicev1 .AgentPoolMode_STATUS_System {
109
110
isUserPool = true
110
111
}
@@ -115,7 +116,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
115
116
if isUserPool {
116
117
Byf ("Scaling the machine pool %s to zero" , mp .Name )
117
118
framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
118
- ClusterProxy : bootstrapClusterProxy ,
119
+ ClusterProxy : input . MgmtCluster ,
119
120
Cluster : input .Cluster ,
120
121
Replicas : 0 ,
121
122
MachinePools : []* expv1.MachinePool {mp },
@@ -125,7 +126,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
125
126
126
127
Byf ("Restoring initial replica count for machine pool %s" , mp .Name )
127
128
framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
128
- ClusterProxy : bootstrapClusterProxy ,
129
+ ClusterProxy : input . MgmtCluster ,
129
130
Cluster : input .Cluster ,
130
131
Replicas : originalReplicas ,
131
132
MachinePools : []* expv1.MachinePool {mp },
0 commit comments