From 8547a5c1ae98a3976a6e9dc17cfe60bb534684f4 Mon Sep 17 00:00:00 2001 From: mqliang Date: Thu, 26 Nov 2015 15:54:42 +0800 Subject: [PATCH] remove TODO: validate namespace --- pkg/api/validation/events.go | 6 +++++- test/integration/auth_test.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/api/validation/events.go b/pkg/api/validation/events.go index fef1e62dd1c..880f38cc787 100644 --- a/pkg/api/validation/events.go +++ b/pkg/api/validation/events.go @@ -24,7 +24,11 @@ import ( // ValidateEvent makes sure that the event makes sense. func ValidateEvent(event *api.Event) validation.ErrorList { allErrs := validation.ErrorList{} - // TODO: There is no namespace required for node. + // There is no namespace required for node. + if event.InvolvedObject.Kind == "Node" && + event.Namespace != "" { + allErrs = append(allErrs, validation.NewInvalidError("involvedObject.namespace", event.InvolvedObject.Namespace, "namespace is not required for node")) + } if event.InvolvedObject.Kind != "Node" && event.Namespace != event.InvolvedObject.Namespace { allErrs = append(allErrs, validation.NewInvalidError("involvedObject.namespace", event.InvolvedObject.Namespace, "namespace does not match involvedObject")) diff --git a/test/integration/auth_test.go b/test/integration/auth_test.go index c98f2214767..94d43b2b270 100644 --- a/test/integration/auth_test.go +++ b/test/integration/auth_test.go @@ -173,7 +173,7 @@ var aEvent string = ` "name": "a"%s }, "involvedObject": { - "kind": "Node", + "kind": "Pod", "namespace": "default", "name": "a", "apiVersion": "v1"