Skip to content

Commit

Permalink
Ensure we filter resources by namespace (#842)
Browse files Browse the repository at this point in the history
This got removed in a recent PR but should not have.

When querying namespaced resources you need the field selector
set. This is not something that can easily be tested in unit tests
since that logic happens on the server side and mocks would not
hit that code.

Fixes #839

Signed-off-by: John Schnake <[email protected]>
  • Loading branch information
johnSchnake authored Aug 15, 2019
1 parent c7d0673 commit 2fb844c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/discovery/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ func QueryResources(
}
}

if ns != nil && len(*ns) > 0 {
opts.FieldSelector = "metadata.namespace=" + *ns
}

// 3. Execute the query
for _, gvr := range resources {
lister := func() (*unstructured.UnstructuredList, error) {
Expand Down

0 comments on commit 2fb844c

Please sign in to comment.