diff --git a/pkg/cache/cache.go b/pkg/cache/cache.go index 4166fc4c9..2dd66770c 100644 --- a/pkg/cache/cache.go +++ b/pkg/cache/cache.go @@ -86,16 +86,16 @@ func (c *serviceAccountCache) Get(name, namespace string) (role, aud string, use } } { - resp := c.getCM(name, namespace) - if resp != nil { - return resp.RoleARN, resp.Audience, resp.UseRegionalSTS, resp.TokenExpiration, nil + respCM := c.getCM(name, namespace) + if respCM != nil { + return respCM.RoleARN, respCM.Audience, respCM.UseRegionalSTS, respCM.TokenExpiration, nil } } - //if no mutation is needed due to annotations return nil err to allow request through if respSA != nil && respSA.RoleARN == "" { return "", "", false, pkg.DefaultTokenExpiration, nil } return "", "", false, pkg.DefaultTokenExpiration, fmt.Errorf("service account %s/%s not found in cache and one is expected", namespace, name) + } func (c *serviceAccountCache) getSA(name, namespace string) *CacheResponse {