-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[WIP] oc create clusterrole: new command #11937
Conversation
|
||
Name string | ||
Resources []string | ||
Actions []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name the options and flags to match the API object fields? (verbs, resources, api-groups, etc)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. I named it "actions" because such name were used in the original issue.
} | ||
|
||
cmd.Flags().StringSliceVarP(&options.Resources, "resources", "", options.Resources, "list of resources (separated by comma)") | ||
cmd.Flags().StringSliceVarP(&options.Actions, "actions", "", options.Actions, "list of actions (separated by comma)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we happy not ever allowing commas in verbs or resources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we happy not ever allowing commas in verbs or resources?
I'm fine with that.
} | ||
|
||
func (o *NewClusterRoleOptions) CreateRole() error { | ||
rule, err := authapi.NewRule(o.Actions...).Resources(o.Resources...).Groups("").Rule() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't assume ""
api group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll likely need to express distinct verb/resource pairings ("create a role that lets me get,list,watch pods and create,update,delete,list,watch replicasets")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll likely need to express distinct verb/resource pairings ("create a role that lets me get,list,watch pods and create,update,delete,list,watch replicasets")
I'd like to have set
commands to handle that sort of thing as well. That would make the need to handle distinct tuples in a single command less important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not understand yet for what this field is used and which values it accepts. Will investigate it..
Commands: []*cobra.Command{ | ||
NewCmdCreateClusterRole(CreateClusterRoleRecommendedName, fullName+" "+CreateClusterRoleRecommendedName, f, out), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should go under the create
subtree, not the policy
subtree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should go under the create subtree, not the policy subtree
I agree. I'd also like to see a pull with the equivalent command upstream for rbac clusterroles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see "create" subtree in oadm
command. I see only commands with prefix "create-" in the "Configuration" subtree. Did you mean this section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's under oc create
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see "create" subtree in oadm command. I see only commands with prefix "create-" in the "Configuration" subtree. Did you mean this section?
oc create clusterrole
is appropriate since its an API resource.
Based on comments in the original issue, it's also desirable to validate the actions and resources passed in. @deads2k is that possible? |
I'd like to see them linted, possibly with a |
Is there a place that we can get a list of known verbs or resources from? |
For resources you can see the discovery doc. For verbs, you could start a "well-known" set upstream. |
resources from discovery, if the server's up (though that won't include virtual resources like nothing in discovery for verbs yet (and even if there is eventually, it won't include verbs like |
89dbf78
to
8b7d749
Compare
8b7d749
to
6b3cf5b
Compare
Origin Action Required: Pull request cannot be automatically merged, please rebase your branch from latest HEAD and push again |
I'm closing this in favor of kubernetes/kubernetes#41538 that will be available after next rebase to the next version of Kubernetes. |
Add a new command
oc create clusterrole
that takes role name, list of actions, list of resources and creates a new cluster role.Example:
Fixes #3804
TODO:
oc create clusterrole
--force
option