Skip to content

Commit

Permalink
Merge pull request #1775 from kmodules/lf
Browse files Browse the repository at this point in the history
馃悰 Trim List if List GVK is provided
  • Loading branch information
k8s-ci-robot committed Jan 12, 2022
2 parents b8db76e + b84b9bb commit 19f9afe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cache/informer_cache.go
Expand Up @@ -96,11 +96,11 @@ func (ip *informerCache) objectTypeForListObject(list client.ObjectList) (*schem
return nil, nil, err
}

if !strings.HasSuffix(gvk.Kind, "List") {
return nil, nil, fmt.Errorf("non-list type %T (kind %q) passed as output", list, gvk)
}
// we need the non-list GVK, so chop off the "List" from the end of the kind
gvk.Kind = gvk.Kind[:len(gvk.Kind)-4]
if strings.HasSuffix(gvk.Kind, "List") && apimeta.IsListType(list) {
gvk.Kind = gvk.Kind[:len(gvk.Kind)-4]
}

_, isUnstructured := list.(*unstructured.UnstructuredList)
var cacheTypeObj runtime.Object
if isUnstructured {
Expand Down

0 comments on commit 19f9afe

Please sign in to comment.