Skip to content

feat: Added support to expose ArgoCD instance URL#20327

Closed
rahulbollisetty wants to merge 13 commits intoargoproj:masterfrom
rahulbollisetty:dev
Closed

feat: Added support to expose ArgoCD instance URL#20327
rahulbollisetty wants to merge 13 commits intoargoproj:masterfrom
rahulbollisetty:dev

Conversation

@rahulbollisetty
Copy link
Copy Markdown

@rahulbollisetty rahulbollisetty commented Oct 10, 2024

FIXES #19547
This PR adds the support for exposing the info about the argocd instance in the clusters/namespaces it manages, by adding a annotation to each resource manifests when URL is configure in argocd-cm.

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).
  • The title of the PR conforms to the Toolchain Guide
  • 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.
  • 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 new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@bunnyshell
Copy link
Copy Markdown

bunnyshell bot commented Oct 10, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Signed-off-by: B Rahul <rahul20bollisetty@gmail.com>
Signed-off-by: B Rahul <rahul20bollisetty@gmail.com>
@rahulbollisetty rahulbollisetty marked this pull request as ready for review October 10, 2024 12:36
@rahulbollisetty rahulbollisetty requested review from a team as code owners October 10, 2024 12:36
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 70.96774% with 9 lines in your changes missing coverage. Please review.

Please upload report for BASE (master@d761c94). Learn more about missing BASE report.
Report is 756 commits behind head on master.

Files with missing lines Patch % Lines
util/argo/resource_tracking.go 64.70% 4 Missing and 2 partials ⚠️
cmd/argocd/commands/app.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #20327   +/-   ##
=========================================
  Coverage          ?   55.08%           
=========================================
  Files             ?      324           
  Lines             ?    55227           
  Branches          ?        0           
=========================================
  Hits              ?    30422           
  Misses            ?    22184           
  Partials          ?     2621           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: B Rahul <rahul20bollisetty@gmail.com>
Signed-off-by: B Rahul <rahul20bollisetty@gmail.com>
Copy link
Copy Markdown
Member

@reggie-k reggie-k left a comment

Choose a reason for hiding this comment

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

I wonder whether we can make use of the AnnotationInstallationID introduced here:
#20222
It seems to tackle a slightly different but similar scenario of being able to know what instance of the multiple ArgoCDs in the cluster manages the resource.
Can this eliminate the need to specify the ArgoCD instance URL explicitly by the user?

@rahulbollisetty
Copy link
Copy Markdown
Author

rahulbollisetty commented Oct 14, 2024

I wonder whether we can make use of the AnnotationInstallationID introduced here: #20222 It seems to tackle a slightly different but similar scenario of being able to know what instance of the multiple ArgoCDs in the cluster manages the resource. Can this eliminate the need to specify the ArgoCD instance URL explicitly by the user?

Well that's a good addition for tracking the resources, but let's say you have multiple ArgoCD (~ 100 instance) instance, and you have access to a cluster, now you want to figure out which ArgoCD instance is managing a resource by looking at the manifest of the resource, it would be really difficult and not user-friendly to find out by just the AnnotationInstallationID, because you do not have a centralized storing mechanism which maps the AnnotationInstallationID: uuid to the ArgoCD instance URL. The PR #20222 helps in differentiating the instances. Keeping a URL annotation would be helpful as well, in my opinion.

@reggie-k
Copy link
Copy Markdown
Member

reggie-k commented Oct 15, 2024

Yeah, that makes sense to me, this PR is definitely a valuable addition, thank you for the implementation and for the explanation!

I wonder whether there is an alternative to the user having to specify the URL explicitly? Like maybe some auto-calculation based on url in ArgoCD config (if url exists, as it is not mandatory) or something else?

@rahulbollisetty
Copy link
Copy Markdown
Author

Yeah, that makes sense to me, this PR is definitely a valuable addition, thank you for the implementation and for the explanation!

I wonder whether there is an alternative to the user having to specify the URL explicitly? Like maybe some auto-calculation based on url in ArgoCD config (if url exists, as it is not mandatory) or something else?

Getting the URL for an ArgoCD instance automatically is tricky because it depends on where and how it's deployed—locally or on a cloud platform like AWS EKS, GKE, or Azure AKS. For cloud deployments, you often need to manually find the LoadBalancer IP. Since there's no built-in way for ArgoCD to automatically grab the URL, you usually have to set it up manually based on your specific setup.

AnnotationInstallationID = "argocd.argoproj.io/installation-id"

// AnnotationKeyAppInstanceID is the Argo CD server URL that is managing this resource
AnnotationKeyAppInstanceID = "argocd.argoproj.io/instance-id"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The naming is confusing. AppInstanceID sounds like an id for the application instance rather than ArgoCD server. I'd also use a more verbose value, like argocd.argoproj.io/argocd-server-instance-id.

}

if err := resourceTracking.SetAppInstanceID(local, argoSettings.URL); err != nil {
log.Warnf("Failed to set Application Instance ID due to missing or invalid ArgoCD URL in ArgoCD Configmap")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No need for Warnf, just use Warn, or include the error.

@anandf
Copy link
Copy Markdown
Member

anandf commented Nov 25, 2024

Can we combine the two identifiers - AnnotationInstallationID and AnnotationKeyAppInstanceID into a single identifier and have two values for it - One is operator readable UUID format and another as a more human readable URL.
eg: argocd.argoproj.io/instance-id: { "uuid": "69384cc9-8870-41fe-b7c2-8c0c1c0ba2ed", "url": "https://argocd-example.myexample.com"}

Since both are optional components, if both of them is not specifiied, we can have an empty value {} and if one of them is specified, then we add only that in the annotation value. {"uuid":"69384cc9-8870-41fe-b7c2-8c0c1c0ba2ed"} or {"url":"https://argocd-example.myexample.com"}

cc: @jannfis

@agaudreault agaudreault closed this Feb 2, 2025
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.

Expose info about the argocd instance in the clusters/namespaces it manages

5 participants