mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
Log apiserver errors that are not of an expected type
Currently HttpLog only expected status range - this logs errors that come back from a REST storage object without being first converted to something in pkg/api/errors. This usually indicates unexpected error conditions that a programmer didn't explicitly check for - the kinds of problems that may need debugging by an operator later. Set to V(1) because they don't impair normal operation.
This commit is contained in:
parent
a5ed10235e
commit
74db9a1b20
@ -22,6 +22,7 @@ import (
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/tools"
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
// statusError is an object that can be converted into an api.Status
|
||||
@ -44,6 +45,11 @@ func errToAPIStatus(err error) *api.Status {
|
||||
case tools.IsEtcdTestFailed(err):
|
||||
status = http.StatusConflict
|
||||
}
|
||||
// Log errors that were not converted to an error status
|
||||
// by REST storage - these typically indicate programmer
|
||||
// error by not using pkg/api/errors, or unexpected failure
|
||||
// cases.
|
||||
glog.V(1).Infof("An unchecked error was received: %v", err)
|
||||
return &api.Status{
|
||||
Status: api.StatusFailure,
|
||||
Code: status,
|
||||
|
Loading…
Reference in New Issue
Block a user