Skip to content

Commit

Permalink
if the kind matches '*List$', treat it as a list
Browse files Browse the repository at this point in the history
  • Loading branch information
laverya committed Feb 12, 2019
1 parent 02d7530 commit fdba7df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion k8sdeps/kunstruct/factory.go
Expand Up @@ -108,7 +108,7 @@ func (kf *KunstructuredFactoryImpl) validate(u unstructured.Unstructured) error
kind := u.GetKind()
if kind == "" {
return fmt.Errorf("missing kind in object %v", u)
} else if kind == "List" {
} else if strings.HasSuffix(kind, "List") {
return nil
}
if u.GetName() == "" {
Expand Down
7 changes: 6 additions & 1 deletion pkg/resource/factory.go
Expand Up @@ -20,6 +20,7 @@ import (
"encoding/json"
"fmt"
"log"
"strings"

"sigs.k8s.io/kustomize/pkg/ifc"
internal "sigs.k8s.io/kustomize/pkg/internal/error"
Expand Down Expand Up @@ -94,10 +95,14 @@ func (rf *Factory) SliceFromBytes(in []byte) ([]*Resource, error) {
for len(kunStructs) > 0 {
u := kunStructs[0]
kunStructs = kunStructs[1:]
if u.GetKind() == "List" {
if strings.HasSuffix(u.GetKind(), "List") {
items := u.Map()["items"]
itemsSlice, ok := items.([]interface{})
if !ok {
if items == nil {
// an empty list
continue
}
return nil, fmt.Errorf("items in List is type %T, expected array", items)
}
for _, item := range itemsSlice {
Expand Down

0 comments on commit fdba7df

Please sign in to comment.