Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Ignore informer sync error #5200

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion pkg/cloud/services/iamauth/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package iamauth
import (
"context"
"fmt"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/iam"
Expand Down Expand Up @@ -124,7 +125,9 @@ func (s *Service) getRolesForMachineDeployments(ctx context.Context, allRoles ma
}
err := s.client.List(ctx, deploymentList, selectors...)
if err != nil {
return fmt.Errorf("failed to list machine deployments for cluster %s/%s: %w", s.scope.Namespace(), s.scope.Name(), err)
if !containsTimeoutSyncError(err) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced that this is the solution to the issue.

It would be good to understand by the informer isn't synced. Do we need to introduce changes to the Cache settings for the manager? Would indexers help?

return fmt.Errorf("failed to list machine deployments for cluster %s/%s: %w", s.scope.Namespace(), s.scope.Name(), err)
}
}

for _, deployment := range deploymentList.Items {
Expand Down Expand Up @@ -208,3 +211,19 @@ func (s *Service) getRolesForAWSManagedMachinePool(ctx context.Context, ref core
}
return nil
}

// Check if a specific Timeout sync error message is in the error chain.
func containsTimeoutSyncError(err error) bool {
for {
if err == nil {
return false
}
// Check if the current error message contains the target message
if strings.Contains(err.Error(), "Timeout: failed waiting for *v1beta1.MachineDeployment Informer to sync") {
return true
}

// Unwrap to check the next error in the chain
err = errors.Unwrap(err)
}
}