|
| 1 | +# Deep Links |
| 2 | + |
| 3 | +Deep links allow users to quickly redirect to third-party systems, such as Splunk, Datadog, etc. from the Argo CD |
| 4 | +user interface. |
| 5 | + |
| 6 | +Argo CD administrator will be able to configure links to third-party systems by providing |
| 7 | +deep link templates configured in `argocd-cm`. The templates can be conditionally rendered and are able |
| 8 | +to reference different types of resources relating to where the links show up, this includes projects, applications, |
| 9 | +or individual resources (pods, services, etc.). |
| 10 | + |
| 11 | +## Configuring Deep Links |
| 12 | + |
| 13 | +The configuration for Deep Links is present in `argocd-cm` as `<location>.links` fields where |
| 14 | +`<location>` determines where it will be displayed. The possible values for `<location>` are : |
| 15 | +- `project` : all links under this field will show up in the project tab in the Argo CD UI |
| 16 | +- `application` : all links under this field will show up in the application summary tab |
| 17 | +- `resource` : all links under this field will show up in the resource (deployments, pods, services, etc.) summary tab |
| 18 | + |
| 19 | +Each link in the list has five subfields : |
| 20 | +1. `title` : title/tag that will be displayed in the UI corresponding to that link |
| 21 | +2. `url` : the actual URL where the deep link will redirect to, this field can be templated to use data from the |
| 22 | + corresponing application, project or resource objects (depending on where it is located). This uses [text/template](pkg.go.dev/text/template) pkg for templating |
| 23 | +3. `description` (optional) : a description for what the deep link is about |
| 24 | +4. `icon.class` (optional) : a font-awesome icon class to be used when displaying the links in dropdown menus |
| 25 | +5. `if` (optional) : a conditional statement that results in either `true` or `false`, it also has access to the same |
| 26 | + data as the `url` field. If the condition resolves to `true` the deep link will be displayed - else it will be hidden. If |
| 27 | + the field is omitted, by default the deep links will be displayed. This uses [antonmedv/expr](https://github.com/antonmedv/expr/tree/master/docs) for evaluating conditions |
| 28 | + |
| 29 | +!!!note |
| 30 | + For resources of kind Secret the data fields are redacted but other fields are accessible for templating the deep links. |
| 31 | + |
| 32 | +!!!warning |
| 33 | + Make sure to validate the url templates and inputs to prevent data leaks or possible generation of any malicious links. |
| 34 | + |
| 35 | + |
| 36 | +An example `argocd-cm.yaml` file with deep links and their variations : |
| 37 | + |
| 38 | +```yaml |
| 39 | + # sample project level links |
| 40 | + project.links: | |
| 41 | + - url: https://myaudit-system.com?project={{.metadata.name}} |
| 42 | + title: Audit |
| 43 | + description: system audit logs |
| 44 | + icon.class: "fa-book" |
| 45 | + # sample application level links |
| 46 | + application.links: | |
| 47 | + # pkg.go.dev/text/template is used for evaluating url templates |
| 48 | + - url: https://mycompany.splunk.com?search={{.spec.destination.namespace}} |
| 49 | + title: Splunk |
| 50 | + # conditionally show link e.g. for specific project |
| 51 | + # github.com/antonmedv/expr is used for evaluation of conditions |
| 52 | + - url: https://mycompany.splunk.com?search={{.spec.destination.namespace}} |
| 53 | + title: Splunk |
| 54 | + if: spec.project == "default" |
| 55 | + - url: https://{{.metadata.annotations.splunkhost}}?search={{.spec.destination.namespace}} |
| 56 | + title: Splunk |
| 57 | + if: metadata.annotations.splunkhost |
| 58 | + # sample resource level links |
| 59 | + resource.links: | |
| 60 | + - url: https://mycompany.splunk.com?search={{.metadata.namespace}} |
| 61 | + title: Splunk |
| 62 | + if: kind == "Pod" || kind == "Deployment" |
| 63 | +``` |
0 commit comments