Verify namespace is not set on root objects

This commit is contained in:
Clayton Coleman
2015-05-07 23:51:36 -04:00
parent 65cf37ab6d
commit 964bc8afda
2 changed files with 37 additions and 0 deletions

View File

@@ -474,6 +474,9 @@ func FilterNamespace(info *Info) error {
// set. If info.Object is set, it will be mutated as well.
func SetNamespace(namespace string) VisitorFunc {
return func(info *Info) error {
if !info.Namespaced() {
return nil
}
if len(info.Namespace) == 0 {
info.Namespace = namespace
UpdateObjectNamespace(info)