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: add the ability to filter apps based on clusters #10465

Merged
merged 1 commit into from Oct 1, 2022

Conversation

my-git9
Copy link
Member

@my-git9 my-git9 commented Aug 27, 2022

Add the ability to filter apps based on clusters

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

@my-git9
Copy link
Member Author

my-git9 commented Aug 27, 2022

The test result:

$  ./dist/argocd app list -c https://10.29.8.20:16443
NAME                  CLUSTER                   NAMESPACE    PROJECT  STATUS     HEALTH   SYNCPOLICY  CONDITIONS                REPO                                                  PATH       TARGET
argocd/guestbookproj  https://10.29.8.20:16443  kube-public  test     OutOfSync  Healthy  <none>      SharedResourceWarning(2)  https://gitlab.daocloud.cn/xin.li/argocd-example.git  guestbook
$
$  ./dist/argocd app list --cluster https://kubernetes.default.svc
NAME                   CLUSTER                         NAMESPACE    PROJECT  STATUS     HEALTH       SYNCPOLICY  CONDITIONS  REPO                                                  PATH            TARGET
argocd/apps            https://kubernetes.default.svc  default      default  OutOfSync  Progressing  <none>      <none>      https://gitlab.daocloud.cn/xin.li/argocd-example.git  apps            HEAD
argocd/guestbook       https://kubernetes.default.svc  default      default  Synced     Healthy      Auto        <none>      https://gitlab.daocloud.cn/xin.li/argocd-example.git  guestbook       HEAD
argocd/guestbook-helm  https://kubernetes.default.svc  default      default  Synced     Healthy      <none>      <none>      https://gitlab.daocloud.cn/xin.li/argocd-example.git  helm-guestbook  HEAD
argocd/guestbook-pub   https://kubernetes.default.svc  kube-public  default  Synced     Healthy      <none>      <none>      https://gitlab.daocloud.cn/xin.li/argocd-example.git  guestbook
argocd/test            https://kubernetes.default.svc  default      default  Synced     Healthy      <none>      <none>      https://gitlab.daocloud.cn/xin.li/argocd-example.git  helm-hooks

@codecov
Copy link

codecov bot commented Aug 27, 2022

Codecov Report

Merging #10465 (e119aca) into master (506bd3b) will decrease coverage by 0.10%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master   #10465      +/-   ##
==========================================
- Coverage   45.78%   45.67%   -0.11%     
==========================================
  Files         233      234       +1     
  Lines       28383    28518     +135     
==========================================
+ Hits        12995    13027      +32     
- Misses      13614    13704      +90     
- Partials     1774     1787      +13     
Impacted Files Coverage Δ
cmd/argocd/commands/app.go 18.86% <0.00%> (-0.05%) ⬇️
util/argo/argo.go 64.93% <0.00%> (-1.91%) ⬇️
util/app/discovery/discovery.go 38.09% <0.00%> (-2.19%) ⬇️
controller/state.go 72.44% <0.00%> (-1.32%) ⬇️
controller/sync.go 54.05% <0.00%> (-1.29%) ⬇️
reposerver/repository/repository.go 61.04% <0.00%> (-0.92%) ⬇️
server/project/project.go 51.68% <0.00%> (-0.83%) ⬇️
util/git/creds.go 39.87% <0.00%> (-0.78%) ⬇️
controller/appcontroller.go 51.78% <0.00%> (-0.53%) ⬇️
... and 9 more

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

@my-git9 my-git9 force-pushed the appcluster branch 3 times, most recently from ca2545e to 1d57e8a Compare August 27, 2022 04:59
@my-git9
Copy link
Member Author

my-git9 commented Aug 29, 2022

Hi @jannfis, Can you review this PR? Thanks

util/argo/argo.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ashutosh16 ashutosh16 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -1293,6 +1296,7 @@ func NewApplicationListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
command.Flags().StringArrayVarP(&projects, "project", "p", []string{}, "Filter by project name")
command.Flags().StringVarP(&repo, "repo", "r", "", "List apps by source repo URL")
command.Flags().StringVarP(&appNamespace, "app-namespace", "N", "", "Only list applications in namespace")
command.Flags().StringVarP(&cluster, "cluster", "c", "", "List apps by cluster")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for this @my-git9! Can you update this string to clarify that either a URL or cluster name is acceptable?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.Do you think this is ok?

Signed-off-by: xin.li <xin.li@daocloud.io>
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 @my-git9!

@crenshaw-dev crenshaw-dev merged commit fa26801 into argoproj:master Oct 1, 2022
ashutosh16 pushed a commit to ashutosh16/argo-cd that referenced this pull request Oct 7, 2022
Signed-off-by: xin.li <xin.li@daocloud.io>

Signed-off-by: xin.li <xin.li@daocloud.io>
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

3 participants