Skip to content

Multi-source ApplicationSet write-back error #1096

@rvandernoort

Description

@rvandernoort

Describe the bug
A clear and concise description of what the bug is.

Hi, I'm trying to add multiple sources to an ApplicationSet from which I only want to update the versions of a single source using git-write back and kustomize. Overall my setup works perfectly as long as I do not put the additional helm chart souces in the ApplicationSet, however I would like to join them. Is this currently possible or should I implement a workaround in which I put the redis instance in a seperate ApplicationSet?

To Reproduce
Steps to reproduce the behavior:

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: rover-test-1
spec:
  goTemplate: true
  goTemplateOptions: ['missingkey=error']
  generators:
    - list:
        elements:
          - environment: staging
          - environment: production
  template:
    metadata:
      name: rover-test-1-{{.environment}}
      annotations:
        argocd-image-updater.argoproj.io/image-list: rover-test=private-registry/rover-test-1
        argocd-image-updater.argoproj.io/rover-test.update-strategy: semver
        argocd-image-updater.argoproj.io/rover-test.allow-tags: regexp:^v[0-9]+.[0-9]+.[0-9]+$|^[a-f0-9]{40}$
        argocd-image-updater.argoproj.io/rover-test.ignore-tags: '^[a-f0-9]{40}$'
        argocd-image-updater.argoproj.io/write-back-method: git
        argocd-image-updater.argoproj.io/write-back-target: kustomization
    spec:
      project: hw-{{.environment}}
      destination:
        namespace: rover-ns-{{.environment}}
        name: cluster-name

      sources:
        - repoURL: 'git@github.com:organisation/gitops.git'
          path: ./deployments/rover-test/overlays/{{.environment}}
          targetRevision: main

        - repoURL: 'registry-1.docker.io/bitnamicharts'
          chart: redis
          targetRevision: 20.11.*
          helm:
            valueFiles:
              - $values/deployments/rover-test/base/redis/values.yaml
        - repoURL: 'https://github.com/orginsation/gitops.git'
          ref: values
          targetRevision: main

which eventually results in the following error message:

time="2025-04-03T10:25:08Z" level=info msg="Successfully updated image 'registry/rover-test-1:v3.4.1' to 'registry/rover-test-1:v3.4.2', but pending spec update (dry run=false)" alias=rover-test application=rover-test-1-staging image_name=registry/rover-test-1 image_tag=v3.4.1 registry=registry
time="2025-04-03T10:25:08Z" level=debug msg="Using commit message: argocd-image-updater: automatic update version of rover-test-1-staging\n\nupdates image registry/rover-test-1 tag 'v3.4.1' to 'v3.4.2'\n
time="2025-04-03T10:25:08Z" level=info msg="Committing 1 parameter update(s) for application rover-test-1-staging" application=rover-test-1-staging
time=\"2025-04-03T10:25:08Z\" level=error msg=\"Could not update application spec: could not get creds for repo 'registry-1.docker.io/bitnamicharts': credentials for 'registry-1.docker.io/bitnamicharts' are not configured in Argo CD settings\" application=rover-test-1-staging"

However, I do believe I have the credentials correctly configured, since I have other ApplicationSets that do get updated correctly like:

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: external-dns
spec:
  goTemplate: true
  goTemplateOptions: ['missingkey=error']
  generators:
    - list:
        elements:
          - name: main
            type: main
            target: main
            cluster: main-cluster
         - ...
  template:
    metadata:
      name: external-dns-{{.name}}
    spec:
      project: hw-infra
      destination:
        namespace: external-dns
        name: '{{.cluster}}'

      sources:
        - repoURL: "registry-1.docker.io/bitnamicharts"
          chart: external-dns
          targetRevision: v8.7.*
          helm:
            valueFiles:
              - $values/deployments/external-dns/values/values-{{.name}}.yaml
        - repoURL: 'https://github.com/organisation/gitops.git'
          ref: values
          targetRevision: '{{.target}}'
        - repoURL: 'https://github.com/organisation/gitops.git'
          path: ./deployments/external-dns/overlays/{{.name}}
          targetRevision: '{{.target}}'

which updates the patch version whenever a new version is available.

I have installed image-updater using kustomize and patch the registries with the credentials using the following patch:

  - target:
      kind: ConfigMap
      name: argocd-image-updater-config
    patch: |-
      - op: add
        path: /data
        value:
          registries.conf: |
            registries:
            - ...
            - name: Docker Hub
              api_url: https://registry-1.docker.io
              ping: yes
              credentials: secret:argocd/docker-credentials#credentials

with my credential secret like this:

apiVersion: v1
kind: Secret
metadata:
  name: docker-credentials
  namespace: argocd
data:
  credentials: redacted
type: Opaque

Expected behavior
A clear and concise description of what you expected to happen.

Preferably I would like that the kustomization writeback to only write back to my kustomization file that are located at the first source. However I think the issue lies in the fact that image-updater tries to also writeback at those external helm resources, which I do not necessarily want. I can understand that possibly this requires some additional configuration to specify a select source to update.

Additional context
Add any other context about the problem here.

Version
Please tell us about the version you encountered the issue with

argo 2.14.9
image-updater 0.16.0

Logs
Please paste any relevant logs here

time="2025-04-03T10:25:08Z" level=info msg="Successfully updated image 'registry/rover-test-1:v3.4.1' to 'registry/rover-test-1:v3.4.2', but pending spec update (dry run=false)" alias=rover-test application=rover-test-1-staging image_name=registry/rover-test-1 image_tag=v3.4.1 registry=registry
time="2025-04-03T10:25:08Z" level=debug msg="Using commit message: argocd-image-updater: automatic update version of rover-test-1-staging\n\nupdates image registry/rover-test-1 tag 'v3.4.1' to 'v3.4.2'\n
time="2025-04-03T10:25:08Z" level=info msg="Committing 1 parameter update(s) for application rover-test-1-staging" application=rover-test-1-staging
time=\"2025-04-03T10:25:08Z\" level=error msg=\"Could not update application spec: could not get creds for repo 'registry-1.docker.io/bitnamicharts': credentials for 'registry-1.docker.io/bitnamicharts' are not configured in Argo CD settings\" application=rover-test-1-staging"

I appreciate any support or insight you can provide!
Kind regards,
Rover

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions