Merge pull request #72577 from dims/strengthen-error-to-api-status-against-bad-input

Strengthen ErrorToAPIStatus against bad input

Kubernetes-commit: d82cf3732213bd38ecd477b6c53fb0236d1662f9
This commit is contained in:
Kubernetes Publisher 2019-01-07 09:51:05 -08:00
commit 40c1ce31b9
3 changed files with 196 additions and 112 deletions

280
Godeps/Godeps.json generated
View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/apiserver", "ImportPath": "k8s.io/apiserver",
"GoVersion": "go1.11", "GoVersion": "go1.11",
"GodepVersion": "v80", "GodepVersion": "v80-k8s-r1",
"Packages": [ "Packages": [
"./..." "./..."
], ],
@ -948,351 +948,351 @@
}, },
{ {
"ImportPath": "k8s.io/api/admission/v1beta1", "ImportPath": "k8s.io/api/admission/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1", "ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/admissionregistration/v1beta1", "ImportPath": "k8s.io/api/admissionregistration/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1", "ImportPath": "k8s.io/api/apps/v1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1beta1", "ImportPath": "k8s.io/api/apps/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/apps/v1beta2", "ImportPath": "k8s.io/api/apps/v1beta2",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/auditregistration/v1alpha1", "ImportPath": "k8s.io/api/auditregistration/v1alpha1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/authentication/v1", "ImportPath": "k8s.io/api/authentication/v1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/authentication/v1beta1", "ImportPath": "k8s.io/api/authentication/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/authorization/v1", "ImportPath": "k8s.io/api/authorization/v1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/authorization/v1beta1", "ImportPath": "k8s.io/api/authorization/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/autoscaling/v1", "ImportPath": "k8s.io/api/autoscaling/v1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/autoscaling/v2beta1", "ImportPath": "k8s.io/api/autoscaling/v2beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/autoscaling/v2beta2", "ImportPath": "k8s.io/api/autoscaling/v2beta2",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v1", "ImportPath": "k8s.io/api/batch/v1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v1beta1", "ImportPath": "k8s.io/api/batch/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/batch/v2alpha1", "ImportPath": "k8s.io/api/batch/v2alpha1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/certificates/v1beta1", "ImportPath": "k8s.io/api/certificates/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/coordination/v1", "ImportPath": "k8s.io/api/coordination/v1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/coordination/v1beta1", "ImportPath": "k8s.io/api/coordination/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/core/v1", "ImportPath": "k8s.io/api/core/v1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/events/v1beta1", "ImportPath": "k8s.io/api/events/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/extensions/v1beta1", "ImportPath": "k8s.io/api/extensions/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/networking/v1", "ImportPath": "k8s.io/api/networking/v1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/policy/v1beta1", "ImportPath": "k8s.io/api/policy/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1", "ImportPath": "k8s.io/api/rbac/v1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1alpha1", "ImportPath": "k8s.io/api/rbac/v1alpha1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/rbac/v1beta1", "ImportPath": "k8s.io/api/rbac/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/scheduling/v1alpha1", "ImportPath": "k8s.io/api/scheduling/v1alpha1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/scheduling/v1beta1", "ImportPath": "k8s.io/api/scheduling/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/settings/v1alpha1", "ImportPath": "k8s.io/api/settings/v1alpha1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1", "ImportPath": "k8s.io/api/storage/v1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1alpha1", "ImportPath": "k8s.io/api/storage/v1alpha1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/api/storage/v1beta1", "ImportPath": "k8s.io/api/storage/v1beta1",
"Rev": "173ce66c1e39d1d0f56e0b3347ff2988068aecd0" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/fuzzer",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip", "ImportPath": "k8s.io/apimachinery/pkg/api/apitesting/roundtrip",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/equality", "ImportPath": "k8s.io/apimachinery/pkg/api/equality",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/errors", "ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/meta", "ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/resource", "ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/validation", "ImportPath": "k8s.io/apimachinery/pkg/api/validation",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/api/validation/path", "ImportPath": "k8s.io/apimachinery/pkg/api/validation/path",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/fuzzer",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/validation", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/validation",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1", "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion", "ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/fields", "ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/labels", "ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime", "ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning", "ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/selection", "ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/types", "ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/cache", "ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/clock", "ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/diff", "ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/errors", "ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/framer", "ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr", "ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/json", "ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch", "ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/naming", "ImportPath": "k8s.io/apimachinery/pkg/util/naming",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/net", "ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/rand", "ImportPath": "k8s.io/apimachinery/pkg/util/rand",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime", "ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/sets", "ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch", "ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/uuid", "ImportPath": "k8s.io/apimachinery/pkg/util/uuid",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation", "ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/wait", "ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/waitgroup", "ImportPath": "k8s.io/apimachinery/pkg/util/waitgroup",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml", "ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/version", "ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/pkg/watch", "ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "849b284f3b756a3fbb5084b09d2718dd41373068" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{ {
"ImportPath": "k8s.io/client-go/discovery", "ImportPath": "k8s.io/client-go/discovery",
@ -1302,14 +1302,6 @@
"ImportPath": "k8s.io/client-go/discovery/fake", "ImportPath": "k8s.io/client-go/discovery/fake",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{
"ImportPath": "k8s.io/client-go/dynamic",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/informers",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{ {
"ImportPath": "k8s.io/client-go/informers/admissionregistration", "ImportPath": "k8s.io/client-go/informers/admissionregistration",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
@ -1498,10 +1490,6 @@
"ImportPath": "k8s.io/client-go/kubernetes", "ImportPath": "k8s.io/client-go/kubernetes",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{
"ImportPath": "k8s.io/client-go/kubernetes/fake",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{ {
"ImportPath": "k8s.io/client-go/kubernetes/scheme", "ImportPath": "k8s.io/client-go/kubernetes/scheme",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
@ -1926,10 +1914,6 @@
"ImportPath": "k8s.io/client-go/tools/cache", "ImportPath": "k8s.io/client-go/tools/cache",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{
"ImportPath": "k8s.io/client-go/tools/clientcmd",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{ {
"ImportPath": "k8s.io/client-go/tools/clientcmd/api", "ImportPath": "k8s.io/client-go/tools/clientcmd/api",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
@ -1950,10 +1934,6 @@
"ImportPath": "k8s.io/client-go/tools/pager", "ImportPath": "k8s.io/client-go/tools/pager",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
}, },
{
"ImportPath": "k8s.io/client-go/tools/record",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{ {
"ImportPath": "k8s.io/client-go/tools/reference", "ImportPath": "k8s.io/client-go/tools/reference",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360" "Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
@ -2014,6 +1994,90 @@
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto", "ImportPath": "k8s.io/kube-openapi/pkg/util/proto",
"Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d" "Rev": "c59034cc13d587f5ef4e85ca0ade0c1866ae8e1d"
}, },
{
"ImportPath": "k8s.io/client-go/discovery",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/dynamic",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/informers",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/informers/auditregistration/v1alpha1",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/kubernetes",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/fake",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/scheme",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authentication/v1beta1",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authorization/v1beta1",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/core/v1",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/listers/admissionregistration/v1beta1",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/listers/core/v1",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/rest",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/testing",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/tools/cache",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd/api",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd/api/v1",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/tools/record",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/util/cert",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{
"ImportPath": "k8s.io/client-go/util/flowcontrol",
"Rev": "7ab9b6348c017e7858f7614f5b0af086e893a360"
},
{ {
"ImportPath": "k8s.io/utils/pointer", "ImportPath": "k8s.io/utils/pointer",
"Rev": "8e7ff06bf0e2d3289061230af203e430a15b6dcc" "Rev": "8e7ff06bf0e2d3289061230af203e430a15b6dcc"

View File

@ -38,11 +38,18 @@ func ErrorToAPIStatus(err error) *metav1.Status {
if len(status.Status) == 0 { if len(status.Status) == 0 {
status.Status = metav1.StatusFailure status.Status = metav1.StatusFailure
} }
if status.Code == 0 {
switch status.Status { switch status.Status {
case metav1.StatusSuccess: case metav1.StatusSuccess:
if status.Code == 0 {
status.Code = http.StatusOK status.Code = http.StatusOK
}
case metav1.StatusFailure: case metav1.StatusFailure:
if status.Code == 0 {
status.Code = http.StatusInternalServerError
}
default:
runtime.HandleError(fmt.Errorf("apiserver received an error with wrong status field : %#+v", err))
if status.Code == 0 {
status.Code = http.StatusInternalServerError status.Code = http.StatusInternalServerError
} }
} }

View File

@ -27,6 +27,19 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
) )
func TestBadStatusErrorToAPIStatus(t *testing.T) {
err := errors.StatusError{}
actual := ErrorToAPIStatus(&err)
expected := &metav1.Status{
TypeMeta: metav1.TypeMeta{Kind: "Status", APIVersion: "v1"},
Status: metav1.StatusFailure,
Code: 500,
}
if !reflect.DeepEqual(actual, expected) {
t.Errorf("%s: Expected %#v, Got %#v", actual, expected, actual)
}
}
func TestAPIStatus(t *testing.T) { func TestAPIStatus(t *testing.T) {
cases := map[error]metav1.Status{ cases := map[error]metav1.Status{
errors.NewNotFound(schema.GroupResource{Group: "legacy.kubernetes.io", Resource: "foos"}, "bar"): { errors.NewNotFound(schema.GroupResource{Group: "legacy.kubernetes.io", Resource: "foos"}, "bar"): {