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

Increase expiration buffer time of OIDCTokenProviders cache to 5 minutes #7355

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/auth/token_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
)

const (
expirationBufferTime = time.Second * 30
expirationBufferTime = 5 * time.Minute
)

type OIDCTokenProvider struct {
Expand Down Expand Up @@ -73,7 +73,7 @@ func (c *OIDCTokenProvider) GetJWT(serviceAccount types.NamespacedName, audience
return "", fmt.Errorf("could not request a token for %s: %w", serviceAccount, err)
}

// we need a duration until this token expires, use the expiry time - (now + 30s)
// we need a duration until this token expires, use the expiry time - (now + 5min)
// this gives us a buffer so that it doesn't expire between when we retrieve it and when we use it
expiryTtl := tokenRequestResponse.Status.ExpirationTimestamp.Time.Sub(time.Now().Add(expirationBufferTime))

Expand Down