It is possible for an application to be
OutOfSync even immediately after a successful Sync operation. Some reasons for this might be:
- There is a bug in the manifest, where it contains extra/unknown fields from the actual K8s spec. These extra fields would get dropped when querying Kubernetes for the live state,
resulting in an
OutOfSyncstatus indicating a missing field was detected.
- The sync was performed (with pruning disabled), and there are resources which need to be deleted.
- A controller or mutating webhook is altering the object after it was submitted to Kubernetes in a manner which contradicts Git.
- A Helm chart is using a template function such as
randAlphaNum, which generates different data every time
helm templateis invoked.
- For Horizontal Pod Autoscaling (HPA) objects, the HPA controller is known to reorder
spec.metricsin a specific order. See kubernetes issue #74099. To work around this, you can order
spec.metricsin Git in the same order that the controller prefers.
In case it is impossible to fix the upstream issue, Argo CD allows you to optionally ignore differences of problematic resources. The diffing customization can be configured for single or multiple application resources or at a system level.
Application Level Configuration¶
Argo CD allows ignoring differences at a specific JSON path, using RFC6902 JSON patches. The following sample application is configured to ignore differences in
spec.replicas for all deployments:
spec: ignoreDifferences: - group: apps kind: Deployment jsonPointers: - /spec/replicas
The above customization could be narrowed to a resource with the specified name and optional namespace:
spec: ignoreDifferences: - group: apps kind: Deployment name: guestbook namespace: default jsonPointers: - /spec/replicas
The comparison of resources with well-known issues can be customized at a system level. Ignored differences can be configured for a specified group and kind
resource.customizations key of
argocd-cm ConfigMap. Following is an example of a customization which ignores the
data: resource.customizations: | admissionregistration.k8s.io/MutatingWebhookConfiguration: ignoreDifferences: | jsonPointers: - /webhooks/0/clientConfig/caBundle