@@ -144,11 +144,12 @@ func UpgradeMachinePoolAndWait(ctx context.Context, input UpgradeMachinePoolAndW
144
144
log .Logf ("Waiting for Kubernetes versions of machines in MachinePool %s/%s to be upgraded from %s to %s" ,
145
145
mp .Namespace , mp .Name , * oldVersion , input .UpgradeVersion )
146
146
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 (),
148
149
Cluster : input .Cluster ,
149
150
MachineCount : int (* mp .Spec .Replicas ),
150
151
KubernetesUpgradeVersion : input .UpgradeVersion ,
151
- MachinePool : * mp ,
152
+ MachinePool : mp ,
152
153
}, input .WaitForMachinePoolToBeUpgraded ... )
153
154
}
154
155
}
@@ -189,10 +190,11 @@ func ScaleMachinePoolAndWait(ctx context.Context, input ScaleMachinePoolAndWaitI
189
190
// WaitForMachinePoolInstancesToBeUpgradedInput is the input for WaitForMachinePoolInstancesToBeUpgraded.
190
191
type WaitForMachinePoolInstancesToBeUpgradedInput struct {
191
192
Getter Getter
193
+ WorkloadClusterGetter Getter
192
194
Cluster * clusterv1.Cluster
193
195
KubernetesUpgradeVersion string
194
196
MachineCount int
195
- MachinePool clusterv1exp.MachinePool
197
+ MachinePool * clusterv1exp.MachinePool
196
198
}
197
199
198
200
// 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
206
208
207
209
log .Logf ("Ensuring all MachinePool Instances have upgraded kubernetes version %s" , input .KubernetesUpgradeVersion )
208
210
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
+ }
209
218
versions := getMachinePoolInstanceVersions (ctx , GetMachinesPoolInstancesInput {
210
219
Getter : input .Getter ,
211
220
Namespace : input .Cluster .Namespace ,
@@ -231,7 +240,7 @@ func WaitForMachinePoolInstancesToBeUpgraded(ctx context.Context, input WaitForM
231
240
type GetMachinesPoolInstancesInput struct {
232
241
Getter Getter
233
242
Namespace string
234
- MachinePool clusterv1exp.MachinePool
243
+ MachinePool * clusterv1exp.MachinePool
235
244
}
236
245
237
246
// getMachinePoolInstanceVersions returns the Kubernetes versions of the machine pool instances.
0 commit comments