About ArgoCD Tracking ID
#SRGThe Service Reliability Group primarily provides comprehensive support for the infrastructure surrounding our media services, focusing on improving existing services, launching new ones, and contributing to open-source software (OSS).
This article explains ArgoCD's Tracking ID, supplementing the Resource Tracking documentation. In the latter half, we'll also discuss how to use Tracking IDs to resolve the management issues of "non-self-referencing resources."
ArgoCD's tracking methodLabel vs AnnotationAbout Tracking IDTracking ID formatUsing Tracking IDs: UI Monitoring of Non-Self-Referencing ResourcesNon-self-referencing resources areSo, what does that mean?Bonus: Understanding Prune from its source codeIn conclusion
ArgoCD's tracking method
ArgoCD provides three main tracking methods for tracking Kubernetes resources:
- Label
- Default method
app.kubernetes.io/instance
- Annotation
- Recommended method
argocd.argoproj.io/tracking-id
- Label+Annotation
- Recommended method
- Label and Tracking ID are handled simultaneously.
- Labels only indicate information; tracking is done through annotations.
For details, please refer to the official documentation:
Label vs Annotation
In many environments using ArgoCD, the default Label method is used.This is used generically, which can sometimes lead to poor identification of the owner when managing resources.
Furthermore, Kubernetes resource labels have a 63-character limit. Of course, most organizations probably won't use labels longer than 63 characters, but for handling "non-self-referencing" resources as described in this article, annotations or label + annotations are more effective than the label method, so we recommend using the annotation method.
If you absolutely must use a Label, we recommend using CustomLabel. For example,The following is an example of how to configure CustomLabel.
For your reference, in a vote by ArgoCon 2024 participants, Resource Tracking (Annotation Method) was unanimously rated as "should be the default setting" in the ArgoCD configuration "Tier Ranking." See the following article for details:
About Tracking ID
ArgoCD v2.2 and later versions include an annotation-based tracking feature. ArgoCD using annotations or Label+Annotation tracks all managed resources.The following annotation will be added.
Tracking ID format
The Tracking ID format is as follows:
<application-name>:<group>/<kind>:<namespace>/<name><application-name>Using Tracking IDs: UI Monitoring of Non-Self-Referencing Resources
Non-self-referencing resources are
In ArgoCD, a "Non-self-referencing" resource refers to a resource whose Tracking ID does not refer to the resource itself.
For example, the following is an example where the Tracking ID points to the resource itself (Self-referencing):
argocd.argoproj.io/tracking-id: dev-fluent-bit:apps/DaemonSet:fluent-bit/fluent-bitAs you can see, this is a DaemonSet of Fluent Bit. From this, you can obtain the following information:
dev-fluent-bit
apps
DaemonSet
fluent-bit
fluent-bit
DaemonSetOn the other hand, in the following example, where the Tracking ID points to a different API resource, it becomes a non-self-referencing resource:
VirtualServicetracking-idIn fact, as with KubeVela mentioned above, in cases where the manifests for actual resources are generated and managed by a separate Application Controller, and ArgoCD only manages KubeVela's Custom Resources, most resources fall under the category of Non-self-referencing resources.

So, what does that mean?
Due to the specifications of the ArgoCD Application Controller, all non-self-referencing resources are excluded from monitoring.In other words, non-self-referencing resources are only displayed in the UI and have no effect whatsoever on the ArgoCD Application's Sync Status.
however,If you select Label as the resource tracking method, all resources will be treated as Self Referencing resources.Non-self-referencing resources are identified only when the Resource Tracking method is Annotation or Label + Annotation.
OutOfSyncThe following are examples using the Label method and the Annotation method.
OutOfSync

- If you change it to Annotation, everything will be fine.

Bonus: Understanding Prune from its source code
This represents the status of each resource in the ArgoCD Application.structureThere is an item called RequiresPrune.
The Application Controller contains a function to compare the current manifest of the Application with the actual manifest.CompareAppStateTherefore, RequiresPrune is determined as follows:
isSelfReferencedObjisSelfReferencedObjtrueIn conclusion
This concludes the supplementary explanation of the Resource Tracking documentation. Tracking ID is a very useful feature and is already being used in many of our projects. We encourage you to consider using it in your projects as well.
SRG is looking for new team members.
If you are interested, please contact us here.
