Skip to content

Commit 856cb3c

Browse files
author
Cecile Robert-Michon
committed
refresh MP
1 parent 25e2f12 commit 856cb3c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test/framework/machinepool_helpers.go

+13-4
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,12 @@ func UpgradeMachinePoolAndWait(ctx context.Context, input UpgradeMachinePoolAndW
144144
log.Logf("Waiting for Kubernetes versions of machines in MachinePool %s/%s to be upgraded from %s to %s",
145145
mp.Namespace, mp.Name, *oldVersion, input.UpgradeVersion)
146146
WaitForMachinePoolInstancesToBeUpgraded(ctx, WaitForMachinePoolInstancesToBeUpgradedInput{
147-
Getter: input.ClusterProxy.GetWorkloadCluster(ctx, input.Cluster.Namespace, input.Cluster.Name).GetClient(),
147+
Getter: mgmtClient,
148+
WorkloadClusterGetter: input.ClusterProxy.GetWorkloadCluster(ctx, input.Cluster.Namespace, input.Cluster.Name).GetClient(),
148149
Cluster: input.Cluster,
149150
MachineCount: int(*mp.Spec.Replicas),
150151
KubernetesUpgradeVersion: input.UpgradeVersion,
151-
MachinePool: *mp,
152+
MachinePool: mp,
152153
}, input.WaitForMachinePoolToBeUpgraded...)
153154
}
154155
}
@@ -189,10 +190,11 @@ func ScaleMachinePoolAndWait(ctx context.Context, input ScaleMachinePoolAndWaitI
189190
// WaitForMachinePoolInstancesToBeUpgradedInput is the input for WaitForMachinePoolInstancesToBeUpgraded.
190191
type WaitForMachinePoolInstancesToBeUpgradedInput struct {
191192
Getter Getter
193+
WorkloadClusterGetter Getter
192194
Cluster *clusterv1.Cluster
193195
KubernetesUpgradeVersion string
194196
MachineCount int
195-
MachinePool clusterv1exp.MachinePool
197+
MachinePool *clusterv1exp.MachinePool
196198
}
197199

198200
// WaitForMachinePoolInstancesToBeUpgraded waits until all instances belonging to a MachinePool are upgraded to the correct kubernetes version.
@@ -206,6 +208,13 @@ func WaitForMachinePoolInstancesToBeUpgraded(ctx context.Context, input WaitForM
206208

207209
log.Logf("Ensuring all MachinePool Instances have upgraded kubernetes version %s", input.KubernetesUpgradeVersion)
208210
Eventually(func() (int, error) {
211+
nn := client.ObjectKey{
212+
Namespace: input.MachinePool.Namespace,
213+
Name: input.MachinePool.Name,
214+
}
215+
if err := input.Getter.Get(ctx, nn, input.MachinePool); err != nil {
216+
return 0, err
217+
}
209218
versions := getMachinePoolInstanceVersions(ctx, GetMachinesPoolInstancesInput{
210219
Getter: input.Getter,
211220
Namespace: input.Cluster.Namespace,
@@ -231,7 +240,7 @@ func WaitForMachinePoolInstancesToBeUpgraded(ctx context.Context, input WaitForM
231240
type GetMachinesPoolInstancesInput struct {
232241
Getter Getter
233242
Namespace string
234-
MachinePool clusterv1exp.MachinePool
243+
MachinePool *clusterv1exp.MachinePool
235244
}
236245

237246
// getMachinePoolInstanceVersions returns the Kubernetes versions of the machine pool instances.

0 commit comments

Comments
 (0)