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

Include serviceaccount namespace #30

Closed
bergerx opened this issue Sep 26, 2019 · 1 comment
Closed

Include serviceaccount namespace #30

bergerx opened this issue Sep 26, 2019 · 1 comment
Assignees
Labels
enhancement Adding additional functionality or improvements good first issue Good for newcomers

Comments

@bergerx
Copy link

bergerx commented Sep 26, 2019

TL;DR: Service accounts are namespaced, they are not like users and groups which are not namespaced. Currently the SUBJECT field in output works fine for users and groups but not for service accounts. For service accounts it only has "ServiceAccount/" which should be something like "ServiceAccount//".

As an example, in our clusters we have a per-namespace "tiller" serviceaccount and each with different set of bindings. They also have rolebindings in other namespaces.

Here is an example case:
We have a tiller service account in dev, qa and demo namespaces. Qa and demo also has explicit access in a monitoring namespace.

Currently when we run rbac-lookup tiller -o wide it prints out RoleBindings for tiller serviceaccounts in any namespace, and its not possible to distinguish which service account has which role.

Example output (mind duplicate line at the beginning, thats not a copy paste mistake):

$ rbac-lookup tiller -o wide
SUBJECT                  SCOPE                    ROLE                              SOURCE
ServiceAccount/tiller    application-monitoring   Role/application-monitoring       RoleBinding/tiller-can-application-monitoring
ServiceAccount/tiller    application-monitoring   Role/application-monitoring       RoleBinding/tiller-can-application-monitoring
ServiceAccount/tiller    dev                      ClusterRole/admin                 RoleBinding/tiller-can-admin
ServiceAccount/tiller    dev                      ClusterRole/prometheus-operator   RoleBinding/tiller-can-prometheus-operator
ServiceAccount/tiller    qa                       ClusterRole/admin                 RoleBinding/tiller-can-admin
ServiceAccount/tiller    qa                       ClusterRole/prometheus-operator   RoleBinding/tiller-can-prometheus-operator

Here is what i'd expect to see:

$ rbac-lookup tiller -o wide
SUBJECT                       SCOPE                    ROLE                              SOURCE
ServiceAccount/qa:tiller      application-monitoring   Role/application-monitoring       RoleBinding/tiller-can-application-monitoring
ServiceAccount/demo:tiller    application-monitoring   Role/application-monitoring       RoleBinding/tiller-can-application-monitoring
ServiceAccount/dev:tiller     dev                      ClusterRole/admin                 RoleBinding/tiller-can-admin
ServiceAccount/dev:tiller     dev                      ClusterRole/prometheus-operator   RoleBinding/tiller-can-prometheus-operator
ServiceAccount/qa:tiller      qa                       ClusterRole/admin                 RoleBinding/tiller-can-admin
ServiceAccount/qa:tiller      qa                       ClusterRole/prometheus-operator   RoleBinding/tiller-can-prometheus-operator
ServiceAccount/demo:tiller    demo                     ClusterRole/admin                 RoleBinding/tiller-can-admin
ServiceAccount/demo:tiller    demo                     ClusterRole/prometheus-operator   RoleBinding/tiller-can-prometheus-operator
@sudermanjr
Copy link
Member

@bergerx I think this is a great idea. We will definitely put this on our list of TODO. Thanks!

@sudermanjr sudermanjr added the enhancement Adding additional functionality or improvements label Sep 26, 2019
@lucasreed lucasreed added the good first issue Good for newcomers label Sep 26, 2019
lucasreed added a commit to lucasreed/rbac-lookup that referenced this issue Sep 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding additional functionality or improvements good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants