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 metadata flags #100

Closed
wants to merge 2 commits into from

Conversation

paulbarfuss
Copy link

Apologies for the delay in re-opening this pull request. This would add only the following functionality to rbac-tool gen and rbac-tool show commands. While the intent of rbac-tool show is not necessarily to generate clusterroles/roles, it made sense to include the flags both places since they call the same generateRole function.

This will also maintain the same default role names and namespace for users that are not passing the new flags.

Generate Role:

rbac-tool gen \
  --allowed-groups ,apps \
  --generated-type Role \
  --name foo \
  --namespace bar \
  --annotations argocd.argoproj.io/sync-wave=2,rbac.authorization.kubernetes.io/autoupdate=true

Output:

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  annotations:
    argocd.argoproj.io/sync-wave: "2"
    rbac.authorization.kubernetes.io/autoupdate: "true"
  creationTimestamp: null
  name: foo
  namespace: bar
rules:
...

Generate ClusterRole:

rbac-tool gen \
  --allowed-groups ,apps \
  --name foo \     
  --annotations argocd.argoproj.io/sync-wave=2,rbac.authorization.kubernetes.io/autoupdate=true

Output:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  annotations:
    argocd.argoproj.io/sync-wave: "2"
    rbac.authorization.kubernetes.io/autoupdate: "true"
  creationTimestamp: null
  name: foo

Thanks again! 😄

Copy link
Contributor

@gadinaor-r7 gadinaor-r7 left a comment

Choose a reason for hiding this comment

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

Looks mostly fine.

the default "custom-cluster-role" should be "custom-role" for compatibility with previous versions

@gadinaor-r7
Copy link
Contributor

see #105

@gadinaor-r7 gadinaor-r7 closed this May 6, 2024
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.

2 participants