Skip to content

Commit bf4afaa

Browse files
committed
Don't derive GVK for generic List type
metav1.List and corev1.List don't conform to the TypeList standard expected by getGVKFromList.
1 parent 8ade6d7 commit bf4afaa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/client/fake/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ func getGVKFromList(list runtime.Object, scheme *runtime.Scheme) (schema.GroupVe
169169
return schema.GroupVersionKind{}, err
170170
}
171171

172+
if gvk.Kind == "List" {
173+
return schema.GroupVersionKind{}, fmt.Errorf("cannot derive GVK for generic List type %T (kind %q)", list, gvk)
174+
}
175+
172176
if !strings.HasSuffix(gvk.Kind, "List") {
173177
return schema.GroupVersionKind{}, fmt.Errorf("non-list type %T (kind %q) passed as output", list, gvk)
174178
}

0 commit comments

Comments
 (0)