Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add namespace for rolebinding on a clusterrole #2170

Merged
merged 2 commits into from
Jul 26, 2023

Conversation

vladfr
Copy link
Contributor

@vladfr vladfr commented Jul 24, 2023

A ClusterRole can be attached to a ServiceAccount via a RoleBinding, granting access only to a specific namespace. This PR adds the namespace name to the ServiceAccount Policy view, for ClusterRoles bound with a RoleBinding.

Fixes #2169

Implementation

I modified the existing code, to keep a map of all the RoleBindings types mapped to namespace.

Signed-off-by: Vlad Fratila <vlad.fratila@gmail.com>
@vladfr
Copy link
Contributor Author

vladfr commented Jul 24, 2023

Screenshot 2023-07-24 at 12 57 08

In the above example, you can see the namespace filled in, but only for the rows granted via the CR:crosspick-pods-view with a RoleBinding.

The other rows are granted via ClusterRoleBinding.

Signed-off-by: Vlad Fratila <vlad.fratila@gmail.com>
Copy link
Owner

@derailed derailed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladfr Thank you for this PR Vlad!! Good catch!

@derailed derailed merged commit f42f19b into derailed:master Jul 26, 2023
@derailed derailed mentioned this pull request Nov 8, 2023
placintaalexandru pushed a commit to placintaalexandru/k9s that referenced this pull request Apr 3, 2024
* add namespace for rolebinding on a clusterrole

Signed-off-by: Vlad Fratila <vlad.fratila@gmail.com>

* remove unused function

Signed-off-by: Vlad Fratila <vlad.fratila@gmail.com>

---------

Signed-off-by: Vlad Fratila <vlad.fratila@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add namespace name in ServiceAccount view with RoleBinding
2 participants