mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
Signed-off-by: rkevin <rk@rkevin.dev>
This commit is contained in:
@@ -225,6 +225,10 @@ const (
|
||||
// Ex: "http://grafana.example.com/d/yu5UH4MMz/deployments"
|
||||
// Ex: "Go to Dashboard|http://grafana.example.com/d/yu5UH4MMz/deployments"
|
||||
AnnotationKeyLinkPrefix = "link.argocd.argoproj.io/"
|
||||
// AnnotationKeyIgnoreDefaultLinks tells the Application to not add autogenerated links from this object into its externalURLs
|
||||
// This applies to ingress objects and takes effect if set to "true"
|
||||
// This only disables the default behavior of generating links based on the ingress spec, and does not disable AnnotationKeyLinkPrefix
|
||||
AnnotationKeyIgnoreDefaultLinks = "argocd.argoproj.io/ignore-default-links"
|
||||
|
||||
// AnnotationKeyAppSkipReconcile tells the Application to skip the Application controller reconcile.
|
||||
// Skip reconcile when the value is "true" or any other string values that can be strconv.ParseBool() to be true.
|
||||
|
||||
14
controller/cache/info.go
vendored
14
controller/cache/info.go
vendored
@@ -225,9 +225,19 @@ func populateIngressInfo(un *unstructured.Unstructured, res *ResourceInfo) {
|
||||
if res.NetworkingInfo != nil {
|
||||
urls = res.NetworkingInfo.ExternalURLs
|
||||
}
|
||||
for url := range urlsSet {
|
||||
urls = append(urls, url)
|
||||
|
||||
enableDefaultExternalURLs := true
|
||||
if ignoreVal, ok := un.GetAnnotations()[common.AnnotationKeyIgnoreDefaultLinks]; ok {
|
||||
if ignoreDefaultLinks, err := strconv.ParseBool(ignoreVal); err == nil {
|
||||
enableDefaultExternalURLs = !ignoreDefaultLinks
|
||||
}
|
||||
}
|
||||
if enableDefaultExternalURLs {
|
||||
for url := range urlsSet {
|
||||
urls = append(urls, url)
|
||||
}
|
||||
}
|
||||
|
||||
res.NetworkingInfo = &v1alpha1.ResourceNetworkingInfo{TargetRefs: targets, Ingress: ingress, ExternalURLs: urls}
|
||||
}
|
||||
|
||||
|
||||
58
controller/cache/info_test.go
vendored
58
controller/cache/info_test.go
vendored
@@ -126,6 +126,40 @@ var (
|
||||
ingress:
|
||||
- ip: 107.178.210.11`)
|
||||
|
||||
testIgnoreDefaultLinksIngress = strToUnstructured(`
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: helm-guestbook
|
||||
namespace: default
|
||||
uid: "4"
|
||||
annotations:
|
||||
link.argocd.argoproj.io/external-link: http://my-grafana.example.com/ingress-link
|
||||
argocd.argoproj.io/ignore-default-links: "true"
|
||||
spec:
|
||||
backend:
|
||||
serviceName: not-found-service
|
||||
servicePort: 443
|
||||
rules:
|
||||
- host: helm-guestbook.example.com
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: helm-guestbook
|
||||
servicePort: 443
|
||||
path: /
|
||||
- backend:
|
||||
serviceName: helm-guestbook
|
||||
servicePort: https
|
||||
path: /
|
||||
tls:
|
||||
- host: helm-guestbook.example.com
|
||||
secretName: my-tls-secret
|
||||
status:
|
||||
loadBalancer:
|
||||
ingress:
|
||||
- ip: 107.178.210.11`)
|
||||
|
||||
testIngressWildCardPath = strToUnstructured(`
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
@@ -1200,6 +1234,30 @@ func TestGetLinkAnnotatedIngressInfo(t *testing.T) {
|
||||
}, info.NetworkingInfo)
|
||||
}
|
||||
|
||||
func TestGetIgnoreDefaultLinksIngressInfo(t *testing.T) {
|
||||
info := &ResourceInfo{}
|
||||
populateNodeInfo(testIgnoreDefaultLinksIngress, info, []string{})
|
||||
assert.Empty(t, info.Info)
|
||||
sort.Slice(info.NetworkingInfo.TargetRefs, func(i, j int) bool {
|
||||
return info.NetworkingInfo.TargetRefs[i].Name < info.NetworkingInfo.TargetRefs[j].Name
|
||||
})
|
||||
assert.Equal(t, &v1alpha1.ResourceNetworkingInfo{
|
||||
Ingress: []corev1.LoadBalancerIngress{{IP: "107.178.210.11"}},
|
||||
TargetRefs: []v1alpha1.ResourceRef{{
|
||||
Namespace: "default",
|
||||
Group: "",
|
||||
Kind: kube.ServiceKind,
|
||||
Name: "helm-guestbook",
|
||||
}, {
|
||||
Namespace: "default",
|
||||
Group: "",
|
||||
Kind: kube.ServiceKind,
|
||||
Name: "not-found-service",
|
||||
}},
|
||||
ExternalURLs: []string{"http://my-grafana.example.com/ingress-link"},
|
||||
}, info.NetworkingInfo)
|
||||
}
|
||||
|
||||
func TestGetIngressInfoWildCardPath(t *testing.T) {
|
||||
info := &ResourceInfo{}
|
||||
populateNodeInfo(testIngressWildCardPath, info, []string{})
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
| argocd.argoproj.io/sync-options | any | [see sync options docs](sync-options.md) | Provides a variety of settings to determine how an Application's resources are synced. |
|
||||
| argocd.argoproj.io/sync-wave | any | [see sync waves docs](sync-waves.md) | |
|
||||
| argocd.argoproj.io/tracking-id | any | any | Used by Argo CD to track resources it manages. See [resource tracking docs](resource_tracking.md) for details. |
|
||||
| argocd.argoproj.io/ignore-resource-updates | any | `"true"`, `false` | Used by Argo CD to ignore resource updates. See [reconcile docs](..%2Foperator-manual%2Freconcile.md)reconcile_docs for details. |
|
||||
| argocd.argoproj.io/ignore-default-links | any | `"true"`, `false` | Do not add autogenerated links to the ArgoCD UI from this resource. [external URL docs](external-url.md) for details. |
|
||||
| argocd.argoproj.io/ignore-resource-updates | any | `"true"`, `false` | Used by Argo CD to ignore resource updates. See [reconcile docs](..%2Foperator-manual%2Freconcile.md)reconcile_docs for details. |
|
||||
| link.argocd.argoproj.io/{some link name} | any | An http(s) URL | Adds a link to the Argo CD UI for the resource. See [external URL docs](external-url.md) for details. |
|
||||
| pref.argocd.argoproj.io/default-pod-sort | Application | [see UI customization docs](../operator-manual/ui-customization.md) | Sets the Application's default grouping mechanism. |
|
||||
| pref.argocd.argoproj.io/default-view | Application | [see UI customization docs](../operator-manual/ui-customization.md) | Sets the Application's default view mode (e.g. "tree" or "list") |
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
# Add external URL
|
||||
# External URL Links
|
||||
|
||||
ArgoCD automatically generates clickable links to external pages that your application exposes.
|
||||
This is usually done via detecting hosts / URLs from your `Ingress` resources.
|
||||
|
||||
## Add external URL
|
||||
|
||||
You can add additional external links to Argo CD dashboard. For example
|
||||
links monitoring pages or documentation instead of just ingress hosts or other apps.
|
||||
links to monitoring pages or documentation, instead of just ingress hosts or other apps.
|
||||
|
||||
ArgoCD generates a clickable links to external pages for a resource based on per resource annotation.
|
||||
ArgoCD generates clickable links to external pages for a resource based on per resource annotation.
|
||||
|
||||
Example:
|
||||
```yaml
|
||||
@@ -20,3 +25,23 @@ The external link icon will be visible for respective resource on ArgoCD applica
|
||||
|
||||

|
||||
|
||||
## Ignore autogenerated external URLs
|
||||
|
||||
If an ingress object should be ignored by ArgoCD's autodetection of external URLs, such as a dummy ingress
|
||||
pointing to a 404 page, you can add the `argocd.argoproj.io/ignore-default-links: "true"` annotation. This will
|
||||
remove any links inferred from the ingress spec from the ArgoCD UI. Any links added by `link.argocd.argoproj.io`
|
||||
annotations are unchanged.
|
||||
|
||||
Example:
|
||||
```yaml
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
link.argocd.argoproj.io/external-link: https://optional.show-me-instead.example.com/
|
||||
argocd.argoproj.io/ignore-default-links: "true"
|
||||
spec:
|
||||
rules:
|
||||
- host: dont-show-me.internal.example.com
|
||||
...
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user