Merge pull request #62734 from liggitt/log-malformed-webhook

Automatic merge from submit-queue (batch tested with PRs 62378, 62734). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Log webhook request error

Fixed https://github.com/kubernetes/kubernetes/issues/26606

```release-note
NONE
```
pull/8/head
Kubernetes Submit Queue 2018-04-18 04:24:13 -07:00 committed by GitHub
commit 96746166d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,7 @@ go_library(
srcs = ["webhook.go"],
importpath = "k8s.io/apiserver/plugin/pkg/authenticator/token/webhook",
deps = [
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/api/authentication/v1beta1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apimachinery/registered:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",

View File

@ -21,6 +21,8 @@ import (
"fmt"
"time"
"github.com/golang/glog"
authentication "k8s.io/api/authentication/v1beta1"
"k8s.io/apimachinery/pkg/apimachinery/registered"
"k8s.io/apimachinery/pkg/runtime/schema"
@ -84,6 +86,8 @@ func (w *WebhookTokenAuthenticator) AuthenticateToken(token string) (user.Info,
return err
})
if err != nil {
// An error here indicates bad configuration or an outage. Log for debugging.
glog.Errorf("Failed to make webhook authenticator request: %v", err)
return nil, false, err
}
r.Status = result.Status