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: support adding labels and annotations to cluster secret (#7115) #7139

Merged
merged 1 commit into from
Sep 9, 2021

Conversation

chetan-rns
Copy link
Member

Signed-off-by: Chetan Banavikalmutt chetanrns1997@gmail.com

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).

Introduces flags to add labels and annotations while creating cluster secrets.

Example:

argocd cluster add api.server.example --label key=obj --annotation key2=obj2

Closes: #7115

@chetan-rns
Copy link
Member Author

@alexmt I assumed we need this feature only while creating clusters. Should there be a provision to update them as well using --upsert?

@codecov
Copy link

codecov bot commented Sep 2, 2021

Codecov Report

Merging #7139 (95c5807) into master (be884d2) will decrease coverage by 0.02%.
The diff coverage is 21.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7139      +/-   ##
==========================================
- Coverage   41.06%   41.04%   -0.03%     
==========================================
  Files         158      158              
  Lines       21274    21300      +26     
==========================================
+ Hits         8736     8742       +6     
- Misses      11285    11305      +20     
  Partials     1253     1253              
Impacted Files Coverage Δ
cmd/argocd/commands/admin/cluster.go 0.00% <0.00%> (ø)
cmd/argocd/commands/cluster.go 5.68% <0.00%> (-0.23%) ⬇️
pkg/apis/application/v1alpha1/types.go 57.51% <0.00%> (-0.36%) ⬇️
cmd/util/cluster.go 41.17% <100.00%> (+1.78%) ⬆️
util/db/cluster.go 60.00% <100.00%> (+0.93%) ⬆️
util/settings/settings.go 47.15% <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 be884d2...95c5807. Read the comment docs.

Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

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

Thank you @chetan-rns ! Please address one comment about Equals method and it is good to go.

// Labels for cluster secret metadata
Labels map[string]string `json:"labels,omitempty" protobuf:"bytes,12,opt,name=labels"`
// Annotations for cluster secret metadata
Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,13,opt,name=annotations"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please update Equals method in types.go as well:

func (c *Cluster) Equals(other *Cluster) bool {

It is used by Create API method to detect difference if cluster is already registered.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Updated Equals to return false on the mismatch of labels/annotations

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

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

LGTM

@alexmt alexmt merged commit 7122b83 into argoproj:master Sep 9, 2021
plakyda-codefresh pushed a commit to plakyda-codefresh/argo-cd that referenced this pull request Sep 28, 2021
…oj#7139)

Signed-off-by: Chetan Banavikalmutt <chetanrns1997@gmail.com>
Signed-off-by: viktorplakida <plakyda1@gmail.com>
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.

"POST /cluster" API and Argo CD CLI should support adding labels and annotations
2 participants