@@ -81,22 +81,21 @@ func (c *serviceAccountCache) Get(name, namespace string) (role, aud string, use
8181 var respSA * CacheResponse
8282 {
8383 respSA = c .getSA (name , namespace )
84- klog .V (5 ).Infof ("Service account %s/%s not found in cache" , namespace , name )
8584 if respSA != nil && respSA .RoleARN != "" {
8685 return respSA .RoleARN , respSA .Audience , respSA .UseRegionalSTS , respSA .TokenExpiration , nil
8786 }
8887 }
8988 {
90- resp := c .getCM (name , namespace )
91- if resp != nil {
92- return resp .RoleARN , resp .Audience , resp .UseRegionalSTS , resp .TokenExpiration , nil
89+ respCM := c .getCM (name , namespace )
90+ if respCM != nil {
91+ return respCM .RoleARN , respCM .Audience , respCM .UseRegionalSTS , respCM .TokenExpiration , nil
9392 }
9493 }
95- //if no mutation is needed due to annotations return nil err to allow request through
96- if respSA != nil && respSA .RoleARN == "" {
97- return "" , "" , false , pkg .DefaultTokenExpiration , nil
94+ if respSA == nil {
95+ return "" , "" , false , pkg .DefaultTokenExpiration , fmt .Errorf ("service account %s/%s not found in cache and one is expected" , namespace , name )
9896 }
99- return "" , "" , false , pkg .DefaultTokenExpiration , fmt .Errorf ("service account %s/%s not found in cache and one is expected" , namespace , name )
97+
98+ return "" , "" , false , pkg .DefaultTokenExpiration , nil
10099}
101100
102101func (c * serviceAccountCache ) getSA (name , namespace string ) * CacheResponse {
0 commit comments