mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 21:12:07 +00:00
remove TODO: validate namespace
This commit is contained in:
parent
7644d34759
commit
8547a5c1ae
@ -24,7 +24,11 @@ import (
|
|||||||
// ValidateEvent makes sure that the event makes sense.
|
// ValidateEvent makes sure that the event makes sense.
|
||||||
func ValidateEvent(event *api.Event) validation.ErrorList {
|
func ValidateEvent(event *api.Event) validation.ErrorList {
|
||||||
allErrs := 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" &&
|
if event.InvolvedObject.Kind != "Node" &&
|
||||||
event.Namespace != event.InvolvedObject.Namespace {
|
event.Namespace != event.InvolvedObject.Namespace {
|
||||||
allErrs = append(allErrs, validation.NewInvalidError("involvedObject.namespace", event.InvolvedObject.Namespace, "namespace does not match involvedObject"))
|
allErrs = append(allErrs, validation.NewInvalidError("involvedObject.namespace", event.InvolvedObject.Namespace, "namespace does not match involvedObject"))
|
||||||
|
@ -173,7 +173,7 @@ var aEvent string = `
|
|||||||
"name": "a"%s
|
"name": "a"%s
|
||||||
},
|
},
|
||||||
"involvedObject": {
|
"involvedObject": {
|
||||||
"kind": "Node",
|
"kind": "Pod",
|
||||||
"namespace": "default",
|
"namespace": "default",
|
||||||
"name": "a",
|
"name": "a",
|
||||||
"apiVersion": "v1"
|
"apiVersion": "v1"
|
||||||
|
Loading…
Reference in New Issue
Block a user