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

Resource deep links can't read metadata annotations from cluster #18466

Open
3 tasks done
jamestrousdale opened this issue May 31, 2024 · 1 comment
Open
3 tasks done
Labels
enhancement New feature or request

Comments

@jamestrousdale
Copy link

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

When attempting to reference cluster annotations via .cluster.metadata.annotations.key in a deep link on a resource, the value isn't retrieved. The same exact usage works from the application level.

I have different logging systems per cluster and I need to tie the base URL for a logging link to the cluster.

I can achieve this via the applicationset templates/generators as well, but it'll require duplicating the logging system base URL to each application where I want to use the deeplink (which is the workaround I'll use for now).

To Reproduce

I've put an annotation on my declarative cluster secret, e.g.

metadata:
    name: my-cluster
    labels:
        argocd.argoproj.io/secret-type: cluster
    annotations:
      deeplinktest: 'deeplinkvalue1'
...

I put a similar annotation on an application via the applicationset template.

  template:
    metadata:
      name: 'my-app-{{cluster}}'
      annotations:
        deeplinktest: 'deeplinkvalue2'
...

I see this annotation show up on the clusters screen in the argo server UI.

I put a links configuration like this in my argocd config map

yaml
  resource.links: |
    - url: https://google.com/{{.cluster.metadata.annotations.deeplinktest}}
      title: Google1
    - url: https://google.com/{{.app.metadata.annotations.deeplinktest}}
      title: Google2

However, only the one on the application level generates the link successfully. See screenshots below, but long story short, the link Google1 attempting to use a cluster annotation directs to https://google.com/<no value>, while the second works correctly and directs to https://google.com/deeplinkvalue2.

Expected behavior

Screenshots

image

image

Version

argocd: v2.9.1+58b04e5
  BuildDate: 2023-11-14T15:08:20Z
  GitCommit: 58b04e5e11d007b0518853029ff7612c24a2eb35
  GitTreeState: clean
  GoVersion: go1.21.3
  Compiler: gc
  Platform: linux/amd64

Logs

I couldn't see any relevant logs generated in the argocd-server container.

@jamestrousdale jamestrousdale added the bug Something isn't working label May 31, 2024
@agaudreault agaudreault removed the bug Something isn't working label Jun 3, 2024
@agaudreault
Copy link
Member

As specified in https://argo-cd.readthedocs.io/en/latest/operator-manual/deep_links/, clusters annotations are not supported. A workaround could be to add the label to each application from the applicationSet, or contribute to the enhancement :)

@agaudreault agaudreault added the enhancement New feature or request label Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants