applicationset icon indicating copy to clipboard operation
applicationset copied to clipboard

Argo CD Image Updater causes an infinite loop of syncs with ApplicationSets

Open RiverPhillips opened this issue 2 years ago • 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: [email protected]: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: [email protected]: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

RiverPhillips avatar Mar 14 '22 11:03 RiverPhillips

Same issue here. Having an option to ignore the tag of the image would be great.

synthe102 avatar May 24 '22 15:05 synthe102

Do we have any workaround?

jizusun avatar May 09 '23 05:05 jizusun

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.

sali2801 avatar May 09 '23 15:05 sali2801

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 https://github.com/argoproj-labs/argocd-image-updater/issues/431

dorsegal avatar May 29 '23 13:05 dorsegal

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.

kyleli666 avatar Aug 11 '23 12:08 kyleli666

Should be resolved by https://github.com/argoproj/argo-cd/pull/14743

jessebye avatar Aug 11 '23 15:08 jessebye

@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.

jessebye avatar Aug 11 '23 15:08 jessebye