Skip to content

Commit

Permalink
Merge pull request #4162 from roehrijn/roehrijn/credentials-cache-fix
Browse files Browse the repository at this point in the history
Fix session surviving cluster purge and recreate through cache
  • Loading branch information
k8s-ci-robot authored Apr 3, 2023
2 parents 646934e + 3636d8f commit d9b62d2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/cloud/scope/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ func sessionForClusterWithRegion(k8sClient client.Client, clusterScoper cloud.Cl
_, err := providers[0].Retrieve()
if err != nil {
conditions.MarkUnknown(clusterScoper.InfraCluster(), infrav1.PrincipalCredentialRetrievedCondition, infrav1.CredentialProviderBuildFailedReason, err.Error())

// delete the existing session from cache. Otherwise, we give back a defective session on next method invocation with same cluster scope
sessionCache.Delete(getSessionName(region, clusterScoper))

return nil, nil, errors.Wrap(err, "Failed to retrieve identity credentials")
}
awsConfig = awsConfig.WithCredentials(credentials.NewChainCredentials(awsProviders))
Expand Down

0 comments on commit d9b62d2

Please sign in to comment.