argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.71k stars 5.4k forks source link

Support `ignoreDifferences` as a resource annotation #12686

Open TimJones opened 1 year ago

TimJones commented 1 year ago

Summary

It would be great if the Application spec ignoreDifferences could be supported at the individual resource level, perhaps as an annotation.

Motivation

I am converting my set up use an ApplicationSets whenever possible to reduce boilerplate. A few Applications require specific ignoreDifferences config. In my case, one app has a ConfigMap resource, and another app updates it with dynamic configuration settings.

Proposal

Ideally similarly to syncOptions can be applied to individual resources via the argocd.argoproj.io/sync-options annotation. So there could be an argocd.argoproj.io/ignore-differences annotation.
Since the annotation is applied to a specific resource, there is no need to define the kubernetes API group in the annotation. It could be further simplified by (initially) only supporting a single jsonPointers type.

i.e.

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-dynamic-config
  annotations:
    argocd.argoproj.io/ignore-differences: /data/config
data:
  config: ''

or it could support being parsed out as a yaml/json object similar to the existing ignoreDifferences spec.

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-dynamic-config
  annotations:
    argocd.argoproj.io/ignore-differences: |-
      jsonPointers:
      - /data/config
data:
  config: ''
thesuperzapper commented 4 months ago

@pasha-codefresh @blakepettersson this feature would be amazing, as it would allow for many more "escape hatches" without needing to update the Application itself.

thesuperzapper commented 4 months ago

This is also related to the request of having the ability for a specific resource to be "ignored" (not updated during a sync) if it has a specific annotation (e.g. argocd.argoproj.io/sync-options: Ignore=true)

Here is the issue for that request:

https://github.com/argoproj/argo-cd/issues/7975

PurseChicken commented 3 months ago

I also have a need for this. Being able to do this on a specific resource via annotation is critical.

Goose29 commented 2 weeks ago

This would be a awesome addition, eliminating the need to manage a large list in the Application CRD.