acorn-io/baaah

Router client doesnt work for non-namespaced resources

Closed this issue · 0 comments

In here:

baaah/pkg/router/client.go

Lines 126 to 141 in 91ce7be

func (a *reader) List(ctx context.Context, list kclient.ObjectList, opts ...kclient.ListOption) error {
listOpt := &kclient.ListOptions{}
for _, opt := range opts {
opt.ApplyToList(listOpt)
}
if listOpt.Namespace == "" {
listOpt.Namespace = a.defaultNamespace
}
if err := a.registry.Watch(list, listOpt.Namespace, "", listOpt.LabelSelector); err != nil {
return err
}
return a.client.List(ctx, list, listOpt)
}

the namespace is set to defaultNamespace if no namespace has been provided.

I was trying to use this to list Nodes, which are not namespaced. This causes the call to break and is inconsistent with how other implementations of the Reader interface behave.