From c8ca49ec886cc86a96cd3ddf1e2a1eecaeade138 Mon Sep 17 00:00:00 2001 From: Eric Chiang Date: Thu, 26 May 2016 11:49:24 -0700 Subject: [PATCH] plugin/pkg/auth/authorizer/webhook: log request errors Currently the API server only checks the errors returned by an authorizer plugin, it doesn't return or log them[0]. This makes incorrectly configuring the wehbook authorizer plugin extremely difficult to debug. Add a logging statement if the request to the remove service fails as this indicates misconfiguration. [0] https://goo.gl/9zZFv4 --- plugin/pkg/auth/authorizer/webhook/webhook.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin/pkg/auth/authorizer/webhook/webhook.go b/plugin/pkg/auth/authorizer/webhook/webhook.go index eeaf2af1d37..2010eaaf39b 100644 --- a/plugin/pkg/auth/authorizer/webhook/webhook.go +++ b/plugin/pkg/auth/authorizer/webhook/webhook.go @@ -22,6 +22,8 @@ import ( "errors" "time" + "github.com/golang/glog" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/apis/authorization/v1beta1" "k8s.io/kubernetes/pkg/auth/authorizer" @@ -149,6 +151,8 @@ func (w *WebhookAuthorizer) Authorize(attr authorizer.Attributes) (err error) { } else { result := w.RestClient.Post().Body(r).Do() if err := result.Error(); err != nil { + // An error here indicates bad configuration or an outage. Log for debugging. + glog.Errorf("Failed to make webhook authorizer request: %v", err) return err } if err := result.Into(r); err != nil {