From 4e2d5a4ec5737762a84039ac04256e834a6d4a99 Mon Sep 17 00:00:00 2001 From: tanjing2020 Date: Fri, 23 Jul 2021 10:26:26 +0800 Subject: [PATCH] Replace with Kubernetes-commit: 1a598798fca6f15f4e883368666e7d4d3565fcc6 --- plugin/pkg/authenticator/token/webhook/webhook.go | 2 +- plugin/pkg/authorizer/webhook/webhook.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/pkg/authenticator/token/webhook/webhook.go b/plugin/pkg/authenticator/token/webhook/webhook.go index 0cafa4d73..af7f07757 100644 --- a/plugin/pkg/authenticator/token/webhook/webhook.go +++ b/plugin/pkg/authenticator/token/webhook/webhook.go @@ -137,7 +137,7 @@ func (w *WebhookTokenAuthenticator) AuthenticateToken(ctx context.Context, token start := time.Now() result, statusCode, tokenReviewErr = w.tokenReview.Create(ctx, r, metav1.CreateOptions{}) - latency := time.Now().Sub(start) + latency := time.Since(start) if statusCode != 0 { w.metrics.RecordRequestTotal(ctx, strconv.Itoa(statusCode)) diff --git a/plugin/pkg/authorizer/webhook/webhook.go b/plugin/pkg/authorizer/webhook/webhook.go index b79701393..4dd08c45e 100644 --- a/plugin/pkg/authorizer/webhook/webhook.go +++ b/plugin/pkg/authorizer/webhook/webhook.go @@ -206,7 +206,7 @@ func (w *WebhookAuthorizer) Authorize(ctx context.Context, attr authorizer.Attri start := time.Now() result, statusCode, sarErr = w.subjectAccessReview.Create(ctx, r, metav1.CreateOptions{}) - latency := time.Now().Sub(start) + latency := time.Since(start) if statusCode != 0 { w.metrics.RecordRequestTotal(ctx, strconv.Itoa(statusCode))