Merge pull request #744 from laverya/skip-empty-object-validation

Skip empty object validation
This commit is contained in:
Kubernetes Prow Robot
2019-01-29 14:37:52 -08:00
committed by GitHub
2 changed files with 15 additions and 0 deletions

View File

@@ -52,6 +52,9 @@ func (kf *KunstructuredFactoryImpl) SliceFromBytes(
var out unstructured.Unstructured
err = decoder.Decode(&out)
if err == nil {
if len(out.Object) == 0 {
continue
}
err = kf.validate(out)
if err != nil {
return nil, err

View File

@@ -109,6 +109,18 @@ WOOOOOOOOOOOOOOOOOOOOOOOOT: woot
expectedOut: []ifc.Kunstructured{},
expectedErr: true,
},
{
name: "emptyObjects",
input: []byte(`
---
#a comment
---
`),
expectedOut: []ifc.Kunstructured{},
expectedErr: false,
},
{
name: "Missing .metadata.name in object",
input: []byte(`