Loop over namespaces when listing reconciled objects #3251
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3231
What changed?
When getting reconciled objects, instead of just looping over kinds and retrieving all objects cluster-wide, loop over only namespaces which the current user has access to, as well as kinds as before.
Why was this change made?
When an OIDC impersonated user does not have cluster-wide privileges, the weave-gitops UI will not show any resources that are reconciled as part of kustomize/helmrelease etc objects. This change means that only objects in namespaces which the user has permissions in will be listed.
How was this change implemented?
Simply providing another option to the client when calling List(), which specifies the namespace to list from, and looping over the namespaces which the user has access to. The list of user-accessible namespaces was already defined a few lines later in the code.
How did you validate the change?
Tested locally/in our production clusters.
We are expecting that existing tests should already cover this and dont need updating.
Release notes
Bugfix, nothing notable
Documentation Changes
None