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
pull/6/head
Eric Chiang 2016-05-26 11:49:24 -07:00
parent 3d332a047b
commit c8ca49ec88
1 changed files with 4 additions and 0 deletions

View File

@ -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 {