mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 07:20:13 +00:00
Merge pull request #24678 from ericchiang/log_webhook_error
Automatic merge from submit-queue 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 <!-- Reviewable:start --> --- This change is [<img src="http://reviewable.k8s.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](http://reviewable.k8s.io/reviews/kubernetes/kubernetes/24678) <!-- Reviewable:end -->
This commit is contained in:
commit
19650207a2
@ -23,6 +23,8 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/apis/authorization/v1beta1"
|
||||
"k8s.io/kubernetes/pkg/auth/authorizer"
|
||||
@ -160,6 +162,8 @@ func (w *WebhookAuthorizer) Authorize(attr authorizer.Attributes) (err error) {
|
||||
return 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
|
||||
}
|
||||
var statusCode int
|
||||
|
Loading…
Reference in New Issue
Block a user