-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
RBAC Support for Actions #2110
RBAC Support for Actions #2110
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2110 +/- ##
==========================================
- Coverage 38.53% 38.25% -0.28%
==========================================
Files 103 103
Lines 14732 14547 -185
==========================================
- Hits 5677 5565 -112
+ Misses 8294 8239 -55
+ Partials 761 743 -18
Continue to review full report at Codecov.
|
CI failure looks unrelated to change. Re-building. |
Not sure which tests are running, but it seems there is an error in build just after a git diff showing a spacing issue
|
The failed test is known flaky. |
Perfect. @jessesuen should be ready to merge |
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.
There is a UI change to this which is not captured here.
@@ -1093,7 +1093,8 @@ func (s *Server) RunResourceAction(ctx context.Context, q *application.ResourceA | |||
Version: q.Version, | |||
Group: q.Group, | |||
} | |||
res, config, _, err := s.getAppResource(ctx, rbacpolicy.ActionOverride, resourceRequest) | |||
actionRequest := fmt.Sprintf("%s/%s", rbacpolicy.ActionAction, q.Action) | |||
res, config, _, err := s.getAppResource(ctx, actionRequest, resourceRequest) |
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.
Thinking about this more, action/<actionname>
is not specific enough. We may have the same action name "pause", which works for both a Deployment, Rollout, and CronJob object. Granting "pause" privileges to all object types is potentially undesirable. We need a convention for actions which reflect the finer grained rbac. For example:
action/argoproj.io/Rollout/resume
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.
Responded in #2181
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.
As I understand, the convention being introduced is action/argoproj.io/Rollout:resume
instead of action/argoproj.io/Rollout/resume
. I feel the slash is more consistent with all our other RBAC as opposed to the colon.
For example, rbac rules may be:
action/argoproj.io/Rollout/*
Which seems better than:
action/argoproj.io/Rollout:*
For the UI to understand and present the available actions. We need to implement action discovery better, as described in item (1) in #2181 |
@jessesuen @alexec Sorry for the crazy delay, but points 1 and 2 from Jesse's issue (#2110) are now done. I intend to open a separate PR for the UI changes. A few points:
argocd app actions run APPNAME resume --kind Rollout is no longer supported and instead must be argocd app actions run APPNAME argoproj.io/Rollout:resume Not sure how to approach this, should I allow backwards compatibility with
$ argocd app actions list blue-green
GROUP KIND NAME ACTION AVAILABLE
argoproj.io Rollout blue-green-helm-guestbook argoproj.io/Rollout:resume true
|
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.
Very close to what I was looking for. Great job.
cmd/argocd/commands/app_actions.go
Outdated
if len(groupKindSplit) != 2 { | ||
log.Fatal("Action name is malformed") | ||
} | ||
return groupKindSplit[0], groupKindSplit[1], actionName |
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 appears we are making breaking changes here by requiring a new convention for running actions. I think it's okay if we start introducing a new convention, but we may need to preserve previous flags for backwards compatibility since many pipelines are depending on this behavior.
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.
Introduced backwards compatibility with the following message:
$ argocd app actions run blue-green resume --kind Rollout
Warning: "resume" action has been deprecated. Please run the action as
argocd app run blue-green argoproj.io/Rollout/resume
@@ -1093,7 +1093,8 @@ func (s *Server) RunResourceAction(ctx context.Context, q *application.ResourceA | |||
Version: q.Version, | |||
Group: q.Group, | |||
} | |||
res, config, _, err := s.getAppResource(ctx, rbacpolicy.ActionOverride, resourceRequest) | |||
actionRequest := fmt.Sprintf("%s/%s", rbacpolicy.ActionAction, q.Action) | |||
res, config, _, err := s.getAppResource(ctx, actionRequest, resourceRequest) |
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.
As I understand, the convention being introduced is action/argoproj.io/Rollout:resume
instead of action/argoproj.io/Rollout/resume
. I feel the slash is more consistent with all our other RBAC as opposed to the colon.
For example, rbac rules may be:
action/argoproj.io/Rollout/*
Which seems better than:
action/argoproj.io/Rollout:*
My review comments above were made without first reading comment #2110 (comment). But yes, I am glad you recognized the breaking change.
How does this work when a user wants to run it against a specific rollout by name? |
@jessesuen Addressed all of your comments.
There is a |
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.
Conditional approval: there's one place where we still use the colon, but otherwise this LGTM. Please fix the last statement.
@alexec @jessesuen This should also be good to go! |
@jessesuen do you want to merge please? |
Yay! |
…tions on App Details page
See #2002