Repository navigation
Conversation
|
|
This allows non-admin users on RBAC enforced clusters to run krr. It does this by: - Adding a new CLI flag called "resources" which allows users to only run krr on specific resources. - Using the `_namespaced_` functions in the k8s python client library where specific namespaces are being queried.
2584629 to
57bdd6d
Compare
|
Hey, @mnbbrown! |
LeaveMyYard
left a comment
There was a problem hiding this comment.
Great work! Found some space to improvements and left them as comments.
| for item in ret.items: | ||
| resources.append(item) | ||
| else: | ||
| for namespace in self.config.namespaces: |
There was a problem hiding this comment.
Here we are doing a for loop in a blocking manner. Using asyncio.gather should give us a performance boost
| list_fns.append(self._list_all_daemon_set) | ||
| if self._should_list_resource("jobs"): | ||
| list_fns.append(self._list_all_jobs) | ||
|
|
There was a problem hiding this comment.
We should add a warning in case filtering by resources ends up in filtering everything, as it might be confusing to user.
| if v == []: | ||
| return "*" | ||
|
|
||
| return v |
There was a problem hiding this comment.
Maybe to also make those resources case-insensitive by adding return [res.lower() for res in v].
With current implementation "Deployment" passed from user in CLI will not make it to show deployments.
|
|
||
| async def _list_resources(self, all_namespaces_fn, namespaced_fn): | ||
| resources = [] | ||
| if self.config.namespaces == "*": |
There was a problem hiding this comment.
I think here you accidentally lost the logic where kube-system is ignored by default (when scanning with "*")
| resources: List[str] = typer.Option( | ||
| None, | ||
| "--resource", | ||
| "-n", |
|
@mnbbrown I can finish your PR, if you want, but I need you to sign the CLA for that |
|
@mnbbrown Hey again! Can you just sign the CLA requested by the bot? I will finish everything else. It will take a few minutes of your time |
|
Remade as #122 |
This allows non-admin users on RBAC enforced clusters to run krr.
It does this by:
Adding a new CLI flag called "resources" which allows users to only
run krr on specific resources.
Using the
_namespaced_functions in the k8s python client librarywhere specific namespaces are being queried.