Skip to content

Commit b4434ec

Browse files
committed
Fix use of UnstructuredList with unregistered typed
Before this change, passing an `unstructured.UnstructuredList` to `client.List()` would erroneously delegate to the typed client, causing an error if the target type isn't registered with the client's scheme, violating the purpose of using `unstructured`. This patch fixes the client so that the `unstructured.UnstructuredList` is delegated to the internal unstructured client.
1 parent d8385e3 commit b4434ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func (c *client) Get(ctx context.Context, key ObjectKey, obj Object) error {
213213
// List implements client.Client
214214
func (c *client) List(ctx context.Context, obj ObjectList, opts ...ListOption) error {
215215
switch obj.(type) {
216-
case *unstructured.Unstructured:
216+
case *unstructured.UnstructuredList:
217217
return c.unstructuredClient.List(ctx, obj, opts...)
218218
case *metav1.PartialObjectMetadataList:
219219
return c.metadataClient.List(ctx, obj, opts...)

0 commit comments

Comments
 (0)