mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
add context to serviceaccount authenticator metrics
This commit is contained in:
parent
7c702138f9
commit
587cadf726
@ -192,9 +192,9 @@ func (v *validator) Validate(ctx context.Context, _ string, public *jwt.Claims,
|
||||
secondsAfterWarn := nowTime.Unix() - warnafter.Time().Unix()
|
||||
auditInfo := fmt.Sprintf("subject: %s, seconds after warning threshold: %d", public.Subject, secondsAfterWarn)
|
||||
audit.AddAuditAnnotation(ctx, "authentication.k8s.io/stale-token", auditInfo)
|
||||
staleTokensTotal.Inc()
|
||||
staleTokensTotal.WithContext(ctx).Inc()
|
||||
} else {
|
||||
validTokensTotal.Inc()
|
||||
validTokensTotal.WithContext(ctx).Inc()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ func (j *jwtTokenAuthenticator) AuthenticateToken(ctx context.Context, tokenData
|
||||
if len(tokenAudiences) == 0 {
|
||||
// only apiserver audiences are allowed for legacy tokens
|
||||
audit.AddAuditAnnotation(ctx, "authentication.k8s.io/legacy-token", public.Subject)
|
||||
legacyTokensTotal.Inc()
|
||||
legacyTokensTotal.WithContext(ctx).Inc()
|
||||
tokenAudiences = j.implicitAuds
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user