Skip to content

Commit 4a15111

Browse files
committed
Ignore informer sync error
Signed-off-by: Aniruddha Basak <[email protected]>
1 parent 1416be7 commit 4a15111

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

pkg/cloud/services/iamauth/reconcile.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package iamauth
1919
import (
2020
"context"
2121
"fmt"
22+
"strings"
2223

2324
"github.com/aws/aws-sdk-go/aws"
2425
"github.com/aws/aws-sdk-go/service/iam"
@@ -124,7 +125,9 @@ func (s *Service) getRolesForMachineDeployments(ctx context.Context, allRoles ma
124125
}
125126
err := s.client.List(ctx, deploymentList, selectors...)
126127
if err != nil {
127-
return fmt.Errorf("failed to list machine deployments for cluster %s/%s: %w", s.scope.Namespace(), s.scope.Name(), err)
128+
if !containsTimeoutSyncError(err) {
129+
return fmt.Errorf("failed to list machine deployments for cluster %s/%s: %w", s.scope.Namespace(), s.scope.Name(), err)
130+
}
128131
}
129132

130133
for _, deployment := range deploymentList.Items {
@@ -208,3 +211,19 @@ func (s *Service) getRolesForAWSManagedMachinePool(ctx context.Context, ref core
208211
}
209212
return nil
210213
}
214+
215+
// Check if a specific Timeout sync error message is in the error chain.
216+
func containsTimeoutSyncError(err error) bool {
217+
for {
218+
if err == nil {
219+
return false
220+
}
221+
// Check if the current error message contains the target message
222+
if strings.Contains(err.Error(), "Timeout: failed waiting for *v1beta1.MachineDeployment Informer to sync") {
223+
return true
224+
}
225+
226+
// Unwrap to check the next error in the chain
227+
err = errors.Unwrap(err)
228+
}
229+
}

0 commit comments

Comments
 (0)