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: equality-based and set-based filtering by label keys and values for list, sync, delete and wait App commands (#10548) #10729

Conversation

maheshbaliga
Copy link
Contributor

@maheshbaliga maheshbaliga commented Sep 28, 2022

This PR resolves the -l / --selector flag part of the issue #10548 , where apps can be filtered with theirs labels and values. It achieves feature-parity with kubectl.

List, Sync, Delete and Wait commands to manage applications can now be filtered by label keys and values. Matching apps must satisfy all of the specified label constraints, though they may have additional labels as well. Equality-based operators allowed are =, == and !=. Set-based operators allowed are exists, not exists, in & notin.

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 Sep 28, 2022

Codecov Report

Base: 45.65% // Head: 45.68% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (5d835dd) compared to base (11c44f2).
Patch coverage: 12.50% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10729      +/-   ##
==========================================
+ Coverage   45.65%   45.68%   +0.02%     
==========================================
  Files         236      236              
  Lines       28702    28706       +4     
==========================================
+ Hits        13104    13113       +9     
+ Misses      13804    13800       -4     
+ Partials     1794     1793       -1     
Impacted Files Coverage Δ
cmd/argocd/commands/app.go 18.50% <0.00%> (-0.20%) ⬇️
server/application/application.go 28.98% <100.00%> (+1.05%) ⬆️
util/settings/settings.go 51.36% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@maheshbaliga maheshbaliga force-pushed the add-more-operators-to-filter-labels branch 5 times, most recently from 841bb08 to 5ea1d94 Compare September 30, 2022 08:48
@crenshaw-dev crenshaw-dev changed the title feat: Added equality-based and set-based filtering by label keys and values; for list, sync and wait App commands. Issue #10548. feat: equality-based and set-based filtering by label keys and values for list, sync and wait App commands (#10548) Oct 1, 2022
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.

This is awesome, @maheshbaliga!

Could you add examples to each of the commands' Example text?

Also, would you have time to implement the same improvement for the argocd app delete command? I just merged -l support for that command.

@maheshbaliga maheshbaliga force-pushed the add-more-operators-to-filter-labels branch from 5ea1d94 to 362d2dc Compare October 2, 2022 05:23
… for list, sync, delete and wait App commands.

Signed-off-by: maheshbaliga <mahesh.baliga@infracloud.io>
@maheshbaliga maheshbaliga force-pushed the add-more-operators-to-filter-labels branch from 362d2dc to 5d835dd Compare October 2, 2022 11:09
@maheshbaliga maheshbaliga changed the title feat: equality-based and set-based filtering by label keys and values for list, sync and wait App commands (#10548) feat: equality-based and set-based filtering by label keys and values for list, sync, delete and wait App commands (#10548) Oct 2, 2022
@maheshbaliga
Copy link
Contributor Author

maheshbaliga commented Oct 2, 2022

@crenshaw-dev, thank you for the review. The examples have been added for List, Sync, Delete & Wait commands. Also, I pulled the label selector changes made to the Delete command and tested it with my code changes. This filtering logic works with Delete command too, since this flow also invokes the List() in application.go.

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.

Thanks @maheshbaliga!

@crenshaw-dev crenshaw-dev merged commit a8e2fb9 into argoproj:master Oct 3, 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.

None yet

2 participants