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

[Feature] Create ServiceAccounts in Namespaces by LabelSelector #264

Closed
MaxRink opened this issue Feb 4, 2022 · 3 comments
Closed

[Feature] Create ServiceAccounts in Namespaces by LabelSelector #264

MaxRink opened this issue Feb 4, 2022 · 3 comments
Labels
enhancement Adding additional functionality or improvements stale Marked as stale by stalebot

Comments

@MaxRink
Copy link

MaxRink commented Feb 4, 2022

Is your feature request related to a problem? Please describe.
Currently i need to manually list all namespaces where i want rbac-manager to create serviceaccounts.
In our case we have a separation between the platform team and the app owner teams, so we need to manually coordinate which namespaces get ServiceAccounts.

Describe the solution you'd like
It would be ideal to have the option to use an LabelSelector for creation of ServiceAccounts in Namespaces like you can do with RoleBindings.
e.g.

  subjects:
  - kind: ServiceAccount 
    name: tenant-sa
    namespaceSelector:    
      matchExpressions:
      - key: platform.example.de/owner
        operator: NotIn
        values:
        - platformteam
@sudermanjr
Copy link
Member

First glance, I think this is really similar (or the same) as #137.

The potential implementation seems different though. In the other issue, I think the desired outcome is that a serviceAccount that has a rolebinding with a label selector automatically triggers creation of the serviceaccount in all the namespaces matched.

This one seems to suggest sort of the opposite? I think we should decide on which is the desired implementation. Personally I lean towards the idea of "if there are multiple namespaces with rolebindings, we create the serviceaccount in each namespace.

What do you think?

@sudermanjr sudermanjr added the triage This bug needs triage label Feb 15, 2022
@MaxRink
Copy link
Author

MaxRink commented Feb 16, 2022

Yes, the implementation is different. I strongly prefer only creating SAs where explicitly wanted, as granular as possible.
Having SAs automatically created in all namespaces matching that binding might be an security issue in some deployments.

@MaxRink
Copy link
Author

MaxRink commented Feb 16, 2022

Being explicit also allows different use-cases.
Lets say i have a multi tenant cluster and i have components in namespaces of tenant x that need to access namespaces of tenant y.
If i dont have a seperate labelSelector for SA and RoleBinding creation i run into the issue that i have overly broad RBAC

@sudermanjr sudermanjr added enhancement Adding additional functionality or improvements and removed triage This bug needs triage labels Feb 16, 2022
@github-actions github-actions bot added the stale Marked as stale by stalebot label Apr 18, 2022
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 stale Marked as stale by stalebot
Projects
None yet
Development

No branches or pull requests

2 participants