Skip to content

Commit

Permalink
refresh MP
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecile Robert-Michon committed May 20, 2021
1 parent 25e2f12 commit 856cb3c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions test/framework/machinepool_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,12 @@ func UpgradeMachinePoolAndWait(ctx context.Context, input UpgradeMachinePoolAndW
log.Logf("Waiting for Kubernetes versions of machines in MachinePool %s/%s to be upgraded from %s to %s",
mp.Namespace, mp.Name, *oldVersion, input.UpgradeVersion)
WaitForMachinePoolInstancesToBeUpgraded(ctx, WaitForMachinePoolInstancesToBeUpgradedInput{
Getter: input.ClusterProxy.GetWorkloadCluster(ctx, input.Cluster.Namespace, input.Cluster.Name).GetClient(),
Getter: mgmtClient,
WorkloadClusterGetter: input.ClusterProxy.GetWorkloadCluster(ctx, input.Cluster.Namespace, input.Cluster.Name).GetClient(),
Cluster: input.Cluster,
MachineCount: int(*mp.Spec.Replicas),
KubernetesUpgradeVersion: input.UpgradeVersion,
MachinePool: *mp,
MachinePool: mp,
}, input.WaitForMachinePoolToBeUpgraded...)
}
}
Expand Down Expand Up @@ -189,10 +190,11 @@ func ScaleMachinePoolAndWait(ctx context.Context, input ScaleMachinePoolAndWaitI
// WaitForMachinePoolInstancesToBeUpgradedInput is the input for WaitForMachinePoolInstancesToBeUpgraded.
type WaitForMachinePoolInstancesToBeUpgradedInput struct {
Getter Getter
WorkloadClusterGetter Getter
Cluster *clusterv1.Cluster
KubernetesUpgradeVersion string
MachineCount int
MachinePool clusterv1exp.MachinePool
MachinePool *clusterv1exp.MachinePool
}

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

log.Logf("Ensuring all MachinePool Instances have upgraded kubernetes version %s", input.KubernetesUpgradeVersion)
Eventually(func() (int, error) {
nn := client.ObjectKey{
Namespace: input.MachinePool.Namespace,
Name: input.MachinePool.Name,
}
if err := input.Getter.Get(ctx, nn, input.MachinePool); err != nil {
return 0, err
}
versions := getMachinePoolInstanceVersions(ctx, GetMachinesPoolInstancesInput{
Getter: input.Getter,
Namespace: input.Cluster.Namespace,
Expand All @@ -231,7 +240,7 @@ func WaitForMachinePoolInstancesToBeUpgraded(ctx context.Context, input WaitForM
type GetMachinesPoolInstancesInput struct {
Getter Getter
Namespace string
MachinePool clusterv1exp.MachinePool
MachinePool *clusterv1exp.MachinePool
}

// getMachinePoolInstanceVersions returns the Kubernetes versions of the machine pool instances.
Expand Down

0 comments on commit 856cb3c

Please sign in to comment.