Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgoCD Image Updater not updating tags in ApplicationSet #861

Open
raviumishra opened this issue Sep 10, 2024 · 11 comments
Open

ArgoCD Image Updater not updating tags in ApplicationSet #861

raviumishra opened this issue Sep 10, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@raviumishra
Copy link

raviumishra commented Sep 10, 2024

ApplicationSet not updating new image tags from azure container registry

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
  metadata:
    name: hub-be
    namespace: dev-argocd-ns
  spec:
    generators:
      - list:
          elements:
            - cluster: dev
              url: [https://dev-aks-use.privatelink.eastus.azmk8s.io:443](https://dev-aks-use.privatelink.eastus.azmk8s.io/)
              namespace: dev-hub-be-ns
    template:
      metadata:
        name: '{{cluster}}-hub-be'
        annotations:
          argocd-image-updater.argoproj.io/image-list: dev=devaksuseACR.azurecr.io/helm/hub-be:*
          argocd-image-updater.argoproj.io/dev.pull-secret: pullsecret:dev-argocd-ns/argocd-image-updater-acr-secret
          argocd-image-updater.argoproj.io/dev.update-strategy: latest
          argocd-image-updater.argoproj.io/write-back-method: git:secret:dev-argocd-ns/argocd-image-updater-git-creds
          argocd-image-updater.argoproj.io/git-branch: feature/argocd
          argocd-image-updater.argoproj.io/dev.force-update: 'true'
      spec:
        project: hub
        source:
          repoURL: devaksuseacr.azurecr.io # ACR repo having OCI artifact
          "targetRevision": "1669"
          chart: helm/hub-be  # Name of the chart in the ACR
          helm:
            valueFiles:
              - values-dev.yaml
        destination:
          server: '{{url}}'
          namespace: '{{namespace}}'
        syncPolicy:
          automated:
            prune: true
            selfHeal: true
          syncOptions:
            CreateNamespace=true

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-image-updater-config
  namespace: dev-argocd-ns
data:
  log.level: debug
  registries.conf: |
    registries:
    - name: Azure Container Registry
      prefix: devaksuseACR.azurecr.io
      api_url: https://devaksuseACR.azurecr.io
      credentials: pullsecret:dev-argocd-ns/argocd-image-updater-acr-secret

Expected behavior
targetRevision to be updated with new tag from Azure container registry in Bitbucket repo ApplicationSet YAML
The current tag in ACR is : 0.1.0-rm-gnr1225.1-669
The current tag in repo YAML file is : 1668
The current tag used by argocd app : 0.1.0-GNR-1225.1-662

Version
(argocd: v2.9.18+151ee6a)

Logs
Logs attached
Uploading argocd-image-updater.log…
: Logs of AIU pod

@raviumishra raviumishra added the bug Something isn't working label Sep 10, 2024
@raviumishra
Copy link
Author

image

@raviumishra raviumishra changed the title AIU not updating tags in ApplicationSet ArgoCD Image Updater not updating tags in ApplicationSet Sep 10, 2024
@chengfang
Copy link
Collaborator

Did you try setting git-repository annotation in the app template? If not, the application source repoURL is used as the git repository for git write-back. See https://argocd-image-updater.readthedocs.io/en/latest/basics/update-methods/#specifying-a-repository-when-using-a-helm-repository-in-repourl

@raviumishra
Copy link
Author

raviumishra commented Sep 11, 2024

@chengfang I am using bitbucket username and app password
argocd-image-updater.argoproj.io/git-repository: [email protected]:ravi_mishra_gp/argocd.git
Do I specify anything under ConfigMap ?

This is the path where my ApplicationSet resides in repo. This YAML needs to be modified by AIU
image

Currently using a bitbucket secret username:app password

apiVersion: v1
kind: Secret
metadata:
  name: argocd-image-updater-git-creds
  namespace: dev-argocd-ns
data:
  password: App password
  username: user name
type: Opaque

@raviumishra
Copy link
Author

raviumishra commented Sep 11, 2024

@chengfang Please help me here.
Tried both these versions :
image
image
image
image
but the targetRevision of YAML was not updated as per the ACR
image
image
image
image

@chengfang
Copy link
Collaborator

argocd-image-updater does not update the helm chart version (targetRevision) in your application. It updates the image name and tag used by your applications, as listed in the image-list annotation.

@raviumishra
Copy link
Author

raviumishra commented Sep 11, 2024

@chengfang are you saying that updater will not update my ApplicationSet yaml in repo ?
The image details in my repo yaml
image
The image on my ACR
image
Image name and tag used by argocd app
image
image

@chengfang
Copy link
Collaborator

image updater will not update your applicationset yaml itself. By default it adds override parameters to the file .argocd-source-<appName>.yaml, and you can configure a custom write-back target such as helm values file. See https://argocd-image-updater.readthedocs.io/en/latest/basics/update-methods/#git-write-back-target

However, from last few lines in the above logs, the image is already up to date, so there will be no update needed.

@raviumishra
Copy link
Author

@chengfang As per the logs the image is up to date. But you can see that the latest image in ACR = 0.1.0-rm-gnr1225.1-673
while the one used by argocd app = 0.1.0-rm-gnr1225.1-672 I dont understand this

@chengfang
Copy link
Collaborator

from the logs, there seems exist a platforms annotation in your application, which filters out images with non-match platforms. If so, can you try removing the platforms annotation?

@raviumishra
Copy link
Author

raviumishra commented Sep 12, 2024

@chengfang Cant find any such annotation in my AppSet yaml

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: hub-be
  namespace: dev-argocd-ns
spec:
  generators:
    - list:
        elements:
          - cluster: dev
            url: https://dev-aks-use.privatelink.eastus.azmk8s.io:443
            namespace: dev-hub-be-ns
  template:
    metadata:
      name: '{{cluster}}-hub-be'
      annotations:
        argocd-image-updater.argoproj.io/image-list: dev=devaksuseACR.azurecr.io/helm/hub-be:*
        argocd-image-updater.argoproj.io/dev.pull-secret: pullsecret:dev-argocd-ns/argocd-image-updater-acr-secret
        argocd-image-updater.argoproj.io/dev.update-strategy: latest
        argocd-image-updater.argoproj.io/git-repository: [email protected]:ravi_mishra_gp/argocd.git
        argocd-image-updater.argoproj.io/write-back-method: git:secret:dev-argocd-ns/argocd-image-updater-git-creds
        argocd-image-updater.argoproj.io/git-branch: feature/argocd
        argocd-image-updater.argoproj.io/dev.force-update: 'true'
    spec:
      project: hub
      source:
        repoURL: devaksuseacr.azurecr.io # ACR repo having OCI artifact
        targetRevision: 0.1.0-rm-gnr1225.1-674 # Chart version
        chart: helm/hub-be  # Name of the chart in the ACR
        helm:
          valueFiles:
            - values-dev.yaml
      destination:
        server: '{{url}}'
        namespace: '{{namespace}}'
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
        syncOptions:
          - CreateNamespace=true
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-image-updater-repo-cm
  namespace: dev-argocd-ns
data:
  repositories.conf: |
    repositories:
    - url: https://bitbucket.org/ravi_mishra_gp/repository.git
      credentials: secret:dev-argocd-ns/argocd-image-updater-git-creds
      imageUpdater:
        repositories:
          - name: devaksuseACR.azurecr.io/helm/hub-be
            tagPattern: "^v[0-9]+\\.[0-9]+\\.[0-9]+$"


@chengfang
Copy link
Collaborator

Cant find any such annotation in my AppSet yaml
ok, that may be some default values.

In your argocd-image-updater-repo-cm configmap, you have tagPattern: "^v[0-9]+\\.[0-9]+\\.[0-9]+$", which may not match the image tag in your registry. This config map doesn't seem to be used, but want to point that out in case the same filtering is used elsewhere.

You may want to try other update strategies if they fit your workflow. The latest strategy requires fetching metadata of all image tags and the quality of these metadata may have influence here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants