Feedback

Chat Icon

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

Sync Policy: Every Field, Every Sync Option, Every Annotation
51%

Ignoring Differences During Sync

Sometimes, you may want to ignore differences between the live and desired states during the diff process. To do this, you reference the fields you want to ignore in the ignoreDifferences field, using JSON pointers or JQ path expressions.

Here is an example:

ignoreDifferences:
  # Ignore differences in the image field of all Deployments
  - group: apps
    kind: Deployment    
    jsonPointers:
    - /spec/template/spec/containers/0/image
  # Ignore differences for the image field 
  # in the init container of the MySQL Deployment.
  # Only the init container named "init" is affected.
  - group: apps
    name: mysql
    kind: Deployment
    jqPathExpressions:
    - '.spec.template.spec.initContainers[] | select(.name == "init") | .image'

To make ignoreDifferences survive a sync, set the RespectIgnoreDifferences option to true in the syncOptions:

syncOptions:
  - RespectIgnoreDifferences=true

Here is a full YAML example with both the ignoreDifferences and syncOptions fields:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: todo-app
  namespace: argocd
spec:
  destination:
    namespace: default
    server

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

Enroll now to unlock all content and receive all future updates for free.