@@ -20,6 +20,7 @@ import (
20
20
"context"
21
21
"fmt"
22
22
"strings"
23
+ "time"
23
24
24
25
"github.com/blang/semver"
25
26
. "github.com/onsi/ginkgo/v2"
@@ -240,11 +241,11 @@ func WaitForMachinePoolInstancesToBeUpgraded(ctx context.Context, input WaitForM
240
241
241
242
log .Logf ("Ensuring all MachinePool Instances have upgraded kubernetes version %s" , input .KubernetesUpgradeVersion )
242
243
Eventually (func () (int , error ) {
243
- nn := client.ObjectKey {
244
+ mpKey := client.ObjectKey {
244
245
Namespace : input .MachinePool .Namespace ,
245
246
Name : input .MachinePool .Name ,
246
247
}
247
- if err := input .Getter .Get (ctx , nn , input .MachinePool ); err != nil {
248
+ if err := input .Getter .Get (ctx , mpKey , input .MachinePool ); err != nil {
248
249
return 0 , err
249
250
}
250
251
versions := getMachinePoolInstanceVersions (ctx , GetMachinesPoolInstancesInput {
@@ -286,16 +287,20 @@ func getMachinePoolInstanceVersions(ctx context.Context, input GetMachinesPoolIn
286
287
versions := make ([]string , len (instances ))
287
288
for i , instance := range instances {
288
289
node := & corev1.Node {}
289
- err := wait .PollUntilContextTimeout (ctx , retryableOperationInterval , retryableOperationTimeout , true , func (ctx context.Context ) (bool , error ) {
290
- err := input .WorkloadClusterGetter .Get (ctx , client.ObjectKey {Name : instance .Name }, node )
291
- if err != nil {
290
+ var nodeGetError error
291
+ err := wait .PollUntilContextTimeout (ctx , 100 * time .Millisecond , 10 * time .Second , true , func (ctx context.Context ) (bool , error ) {
292
+ nodeGetError = input .WorkloadClusterGetter .Get (ctx , client.ObjectKey {Name : instance .Name }, node )
293
+ if nodeGetError != nil {
292
294
return false , nil //nolint:nilerr
293
295
}
294
296
return true , nil
295
297
})
296
298
if err != nil {
297
- // Dump the instance name and error here so that we can log it as part of the version array later on.
298
- versions [i ] = fmt .Sprintf ("%s error: %s" , instance .Name , err )
299
+ versions [i ] = "unknown"
300
+ if nodeGetError != nil {
301
+ // Dump the instance name and error here so that we can log it as part of the version array later on.
302
+ versions [i ] = fmt .Sprintf ("%s error: %s" , instance .Name , errors .Wrap (err , nodeGetError .Error ()))
303
+ }
299
304
} else {
300
305
versions [i ] = node .Status .NodeInfo .KubeletVersion
301
306
}
0 commit comments