Skip to content

Commit

Permalink
Merge pull request #1244 from ulucinar/fix-cache-key
Browse files Browse the repository at this point in the history
Use Generation instead of ResourceVersion when computing the cache key
  • Loading branch information
ulucinar committed Mar 28, 2024
2 parents 9c77960 + 8dbbc58 commit 053d318
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/clients/creds_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"io"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -82,7 +83,7 @@ func NewAWSCredentialsProviderCache(opts ...AWSCredentialsProviderCacheOption) *
type AWSCredentialsProviderCache struct {
// cache holds the AWS Config with a unique cache key per
// provider configuration. Key content includes the ProviderConfig's UUID
// and ResourceVersion and additional fields depending on the auth method
// and Generation and additional fields depending on the auth method
// (currently only IRSA temporary credential caching is supported).
cache map[string]*awsCredentialsProviderCacheEntry

Expand Down Expand Up @@ -170,7 +171,7 @@ func (c *AWSCredentialsProviderCache) RetrieveCredentials(ctx context.Context, p
// to ensure unique keys.
//
// Parameters that are directly available in the provider config will
// generate unique cache keys through UUID and ResourceVersion of
// generate unique cache keys through UUID and Generation of
// the ProviderConfig's k8s object, as they change when the provider
// config is modified.
//
Expand All @@ -180,7 +181,7 @@ func (c *AWSCredentialsProviderCache) RetrieveCredentials(ctx context.Context, p
// should be included in the cache key.
cacheKeyParams := []string{
string(pc.UID),
pc.ResourceVersion,
strconv.FormatInt(pc.Generation, 10),
region,
string(pc.Spec.Credentials.Source),
}
Expand Down

0 comments on commit 053d318

Please sign in to comment.