Argo CD Image Updater causes an infinite loop of syncs with ApplicationSets
RiverPhillips opened this issue · 7 comments
Describe the bug
I am using ApplicationSets to deploy multiple applications, the template for this ApplicationSet is creating applications with the required annotations for the image updater. This leads to the applications syncing constantly.
I cannot use git writeback with the Argo image updater as I want to ensure the image tagged main is always deployed.
I have raised a bug with the Argo CD Image updater and they suspect the issue lies with ApplicationSets
To Reproduce
Steps to reproduce the behaviour:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: name
namespace: argocd
spec:
generators:
- git:
directories:
- path: manifests/*/overlays/dev
repoURL: git@github.com:org/repo.git
revision: HEAD
template:
metadata:
annotations:
argocd-image-updater.argoproj.io/image-list: app=foo:main
argocd-image-updater.argoproj.io/app.update-strategy: digest
name: '{{path[1]}}'
spec:
destination:
namespace: name
server: https://kubernetes.default.svc/
project: project
source:
path: '{{path}}'
repoURL: git@github.com:org/repo.git
targetRevision: HEAD
Expected behaviour
When the image digest changes there should be a sync, but this should not be an infinite loop.
Version
Argo CD: v2.3.1
Argo CD Image Updater: v 0.11.3
Same issue here. Having an option to ignore the tag of the image would be great.
Do we have any workaround?
what about if you add write-back-method. From the doc:
As a rule of thumb, if you are managing Application in Git (i.e. in an app-of-apps setup), you most likely want to chose the Git write-back method.
I am experiencing the same issue. Also the logs show that the image was updated but nothing happens on Argocd Application side. maybe related to this argoproj-labs/argocd-image-updater#431
I found a workaround is to change the policy of ApplicationSet controller - https://argocd-applicationset.readthedocs.io/en/stable/Controlling-Resource-Modification/#policy-create-only-prevent-applicationset-controller-from-modifying-or-deleting-applications
Use a policy that does not include "update", e.g. "create-delete" in my case in Helm values
## Argo Configs
configs:
# Argo CD configuration parameters
## Ref: https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/argocd-cmd-params-cm.yaml
params:
## ApplicationSet Properties
# -- Modify how application is synced between the generator and the cluster. One of: `sync`, `create-only`, `create-update`, `create-delete`
applicationsetcontroller.policy: create-delete
Then ApplicationSet will not be able to apply any updates in Applications, so image updater finally gets the chance to work.
Should be resolved by argoproj/argo-cd#14743
@kyleli666 Yes, this workaround is OK as long as you don't need updates to your applications to be synced. In our case, we need to update the applications sometimes to change things like the ref, so we can't use the workaround.