mirror of https://github.com/k3s-io/k3s
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/9zZFv4pull/6/head
parent
3d332a047b
commit
c8ca49ec88
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue