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

feat: allow argocd cluster rotate-auth to accept cluster name #9838

Merged
merged 3 commits into from Jul 8, 2022

Conversation

danielhelfand
Copy link
Contributor

Closes #9554

Allows the argocd cluster rotate-auth command to accept the cluster name as argument in addition to server.

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

@codecov
Copy link

codecov bot commented Jun 30, 2022

Codecov Report

Merging #9838 (37ae168) into master (61c09dd) will increase coverage by 0.04%.
The diff coverage is 23.63%.

@@            Coverage Diff             @@
##           master    #9838      +/-   ##
==========================================
+ Coverage   45.78%   45.82%   +0.04%     
==========================================
  Files         227      227              
  Lines       26994    27005      +11     
==========================================
+ Hits        12359    12375      +16     
+ Misses      12952    12941      -11     
- Partials     1683     1689       +6     
Impacted Files Coverage Δ
cmd/argocd/commands/cluster.go 8.89% <0.00%> (-0.08%) ⬇️
server/cluster/cluster.go 35.84% <27.65%> (+5.88%) ⬆️
util/settings/settings.go 48.17% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61c09dd...37ae168. Read the comment docs.

Copy link
Collaborator

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Nitpicks. :-)

cmd/argocd/commands/cluster.go Outdated Show resolved Hide resolved
if q.Name != "" {
servers, err = s.db.GetClusterServersByName(ctx, q.Name)
if err != nil {
return nil, err
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is a new potential error, can this be wrapped? status.Errorf("failed to get cluster servers by name: %w", err).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some error context. status.Errorf does not support %w so I used %v.

}
for _, server := range servers {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceClusters, rbacpolicy.ActionUpdate, createRBACObject(clust.Project, server)); err != nil {
return nil, err
Copy link
Collaborator

Choose a reason for hiding this comment

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

Even though this wasn't previously wrapped, it probably should be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, let me know if error message can be improved.

}
} else {
if err := s.enf.EnforceErr(ctx.Value("claims"), rbacpolicy.ResourceClusters, rbacpolicy.ActionUpdate, createRBACObject(clust.Project, q.Server)); err != nil {
return nil, err
Copy link
Collaborator

Choose a reason for hiding this comment

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

More wrapping, if you've got time.

Signed-off-by: Daniel Helfand <helfand.4@gmail.com>
Signed-off-by: Daniel Helfand <helfand.4@gmail.com>
Signed-off-by: Daniel Helfand <helfand.4@gmail.com>
Copy link
Collaborator

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

lgtm!

@crenshaw-dev crenshaw-dev enabled auto-merge (squash) July 8, 2022 15:11
@crenshaw-dev crenshaw-dev merged commit 335ffa8 into argoproj:master Jul 8, 2022
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.

Allow cluster rotate auth to accept cluster name as argument
2 participants