@@ -38,6 +38,7 @@ import (
3838)
3939
4040type AKSMachinePoolSpecInput struct {
41+ MgmtCluster framework.ClusterProxy
4142 Cluster * clusterv1.Cluster
4243 MachinePools []* expv1.MachinePool
4344 WaitIntervals []interface {}
@@ -57,7 +58,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
5758
5859 Byf ("Scaling machine pool %s out" , mp .Name )
5960 framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
60- ClusterProxy : bootstrapClusterProxy ,
61+ ClusterProxy : input . MgmtCluster ,
6162 Cluster : input .Cluster ,
6263 Replicas : ptr .Deref (mp .Spec .Replicas , 0 ) + 1 ,
6364 MachinePools : []* expv1.MachinePool {mp },
@@ -66,7 +67,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
6667
6768 Byf ("Scaling machine pool %s in" , mp .Name )
6869 framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
69- ClusterProxy : bootstrapClusterProxy ,
70+ ClusterProxy : input . MgmtCluster ,
7071 Cluster : input .Cluster ,
7172 Replicas : ptr .Deref (mp .Spec .Replicas , 0 ) - 1 ,
7273 MachinePools : []* expv1.MachinePool {mp },
@@ -78,7 +79,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
7879 switch mp .Spec .Template .Spec .InfrastructureRef .Kind {
7980 case infrav1 .AzureManagedMachinePoolKind :
8081 ammp := & infrav1.AzureManagedMachinePool {}
81- err := bootstrapClusterProxy .GetClient ().Get (ctx , types.NamespacedName {
82+ err := input . MgmtCluster .GetClient ().Get (ctx , types.NamespacedName {
8283 Namespace : mp .Spec .Template .Spec .InfrastructureRef .Namespace ,
8384 Name : mp .Spec .Template .Spec .InfrastructureRef .Name ,
8485 }, ammp )
@@ -89,7 +90,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
8990 }
9091 case infrav1 .AzureASOManagedMachinePoolKind :
9192 ammp := & infrav1.AzureASOManagedMachinePool {}
92- err := bootstrapClusterProxy .GetClient ().Get (ctx , types.NamespacedName {
93+ err := input . MgmtCluster .GetClient ().Get (ctx , types.NamespacedName {
9394 Namespace : mp .Spec .Template .Spec .InfrastructureRef .Namespace ,
9495 Name : mp .Spec .Template .Spec .InfrastructureRef .Name ,
9596 }, ammp )
@@ -104,7 +105,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
104105 // mode may not be set in spec. Get the ASO object and check in status.
105106 resource .SetNamespace (ammp .Namespace )
106107 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 ())
108109 if ptr .Deref (agentPool .Status .Mode , "" ) != asocontainerservicev1 .AgentPoolMode_STATUS_System {
109110 isUserPool = true
110111 }
@@ -115,7 +116,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
115116 if isUserPool {
116117 Byf ("Scaling the machine pool %s to zero" , mp .Name )
117118 framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
118- ClusterProxy : bootstrapClusterProxy ,
119+ ClusterProxy : input . MgmtCluster ,
119120 Cluster : input .Cluster ,
120121 Replicas : 0 ,
121122 MachinePools : []* expv1.MachinePool {mp },
@@ -125,7 +126,7 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
125126
126127 Byf ("Restoring initial replica count for machine pool %s" , mp .Name )
127128 framework .ScaleMachinePoolAndWait (ctx , framework.ScaleMachinePoolAndWaitInput {
128- ClusterProxy : bootstrapClusterProxy ,
129+ ClusterProxy : input . MgmtCluster ,
129130 Cluster : input .Cluster ,
130131 Replicas : originalReplicas ,
131132 MachinePools : []* expv1.MachinePool {mp },
@@ -136,3 +137,32 @@ func AKSMachinePoolSpec(ctx context.Context, inputGetter func() AKSMachinePoolSp
136137
137138 wg .Wait ()
138139}
140+
141+ type AKSMachinePoolPostUpgradeSpecInput struct {
142+ MgmtCluster framework.ClusterProxy
143+ ClusterName string
144+ ClusterNamespace string
145+ }
146+
147+ func AKSMachinePoolPostUpgradeSpec (ctx context.Context , inputGetter func () AKSMachinePoolPostUpgradeSpecInput ) {
148+ input := inputGetter ()
149+
150+ cluster := framework .GetClusterByName (ctx , framework.GetClusterByNameInput {
151+ Getter : input .MgmtCluster .GetClient (),
152+ Name : input .ClusterName ,
153+ Namespace : input .ClusterNamespace ,
154+ })
155+ mps := framework .GetMachinePoolsByCluster (ctx , framework.GetMachinePoolsByClusterInput {
156+ Lister : input .MgmtCluster .GetClient (),
157+ ClusterName : input .ClusterName ,
158+ Namespace : input .ClusterNamespace ,
159+ })
160+ AKSMachinePoolSpec (ctx , func () AKSMachinePoolSpecInput {
161+ return AKSMachinePoolSpecInput {
162+ MgmtCluster : input .MgmtCluster ,
163+ Cluster : cluster ,
164+ MachinePools : mps ,
165+ WaitIntervals : e2eConfig .GetIntervals ("default" , "wait-machine-pool-nodes" ),
166+ }
167+ })
168+ }
0 commit comments