-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
In the List function, the client's namespace is appended to the ListOptions regardless of the scope of the objects:
controller-runtime/pkg/client/namespaced_client.go
Lines 224 to 226 in c8a5a35
| if n.namespace != "" { | |
| opts = append(opts, InNamespace(n.namespace)) | |
| } |
This makes it unusable with objects that have a cluster-wide scope, as it will never find anything.
It is also inconsistent with the Get implementation, where there is a check if the object is namepaced or not, before setting the namespace:
controller-runtime/pkg/client/namespaced_client.go
Lines 209 to 218 in c8a5a35
| isNamespaceScoped, err := n.IsObjectNamespaced(obj) | |
| if err != nil { | |
| return fmt.Errorf("error finding the scope of the object: %w", err) | |
| } | |
| if isNamespaceScoped { | |
| if key.Namespace != "" && key.Namespace != n.namespace { | |
| return fmt.Errorf("namespace %s provided for the object %s does not match the namespace %s on the client", key.Namespace, obj.GetName(), n.namespace) | |
| } | |
| key.Namespace = n.namespace | |
| } |
Metadata
Metadata
Assignees
Labels
No labels