argo-cd
argo-cd copied to clipboard
Cluster Scoped resources with annotation tracking always show diff
Checklist:
- [ x ] I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
- [ x ] I've included steps to reproduce the bug.
- [ x ] I've pasted the output of
argocd version
.
Describe the bug
Cluster Scoped resources (provisioned outside of the ArgoCD app) always show as having diffs if they are tracked to a Namespace Scoped resource within an ArgoCD app.
This seems to be closely related to https://github.com/argoproj/argo-cd/issues/8683#issuecomment-1111605207
To Reproduce
- Set
application.resourceTrackingMethod
toannotation
- Create a new application, e.g.
kustomize-guestbook
from https://github.com/argoproj/argocd-example-apps, with a target namespace ofguestbook
- Sync the application. Make sure that Argo CD has put on tracking annotations on the live resources instead of the label, e.g.
annotations:
argocd.argoproj.io/tracking-id: 'guestbook:/Service:guestbook/guestbook-ui'
- Create a Cluster Scoped resource, for example a
ClusterRole
:
kubectl create clusterrole guestbook-pod-reader --verb=get,list,watch --resource=pods
- Annotate the Cluster Scoped resource so that it is tracked by the Deployment
kubectl annotate clusterrole guestbook-pod-reader argocd.argoproj.io/tracking-id='guestbook:apps/Deployment:guestbook/guestbook-ui'
- Observe the application
Diff
is disabled in the UI. - Observe the Cluster Scoped resource has a diff.
Expected behavior
The Cluster Scope resource with annotation tracking should behave like any Namespace scoped resource that has ownership metadata defined. The Diff and Desired Manifest tabs should not be displayed.
Screenshots
:white_check_mark: Namespace scoped resource with ownership metadata defined:
:x: Cluster Scoped resource using annotation tracking:
Version
argocd: v2.8.16+a5ae7bd
BuildDate: 2024-04-15T09:10:52Z
GitCommit: a5ae7bd16143814dc8560da0e476905ed1d46628
GitTreeState: clean
GoVersion: go1.20.14
Compiler: gc
Platform: linux/amd64
argocd-server: v2.10.6+d504d2b
BuildDate: 2024-04-05T00:27:47Z
GitCommit: d504d2b1d92f0cf831a124a5fd1a96ee29fa7679
GitTreeState: clean
GoVersion: go1.21.3
Compiler: gc
Platform: linux/amd64
Kustomize Version: v5.2.1 2023-10-19T20:13:51Z
Helm Version: v3.14.3+gf03cc04
Kubectl Version: v0.26.11
Jsonnet Version: v0.20.0
Logs
Paste any relevant application logs here.
Also related to #5082