gaurav agnihotri
gaurav agnihotri

Reputation: 387

Argocd image updater giving Could not get tags from registry: denied: Failed to read tags for host 'gcr.io' Error

I am trying to use the ArgoCd-image-updater , but it is giving me the below error

time="2022-09-13T15:40:02Z" level=debug msg="Using version constraint '^0.1' when looking for a new tag" alias= application=ms-echoserver-imageupdate-test image_name=test-build/argo-imageupdater-test image_tag=0.9 registry=gcr.io
time="2022-09-13T15:40:02Z" level=error msg="Could not get tags from registry: denied: Failed to read tags for host 'gcr.io', repository '/v2/test-build/argo-imageupdater-test/tags/list'" alias= application=ms-echoserver-imageupdate-test image_name=test-build/argo-imageupdater-test image_tag=0.9 registry=gcr.io
time="2022-09-13T15:40:02Z" level=info msg="Processing results: applications=1 images_considered=1 images_skipped=0 images_updated=0 errors=1"

My argocd image updater config file:-

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-image-updater-config
  labels:
    app.kubernetes.io/name: argocd-image-updater-config
    app.kubernetes.io/part-of: argocd-image-updater

data:
  log.level: debug
  registries.conf: |
    registries:
    - name: Google Container Registry
      api_url: https://gcr.io
      ping: no
      prefix: gcr.io
      credentials: pullsecret:argocd/gcr-imageupdater
      #credentials: secret:argocd/sundayy#creds

Note:- Secret is having owner permission.

Upvotes: 1

Views: 2698

Answers (2)

Rotem jackoby
Rotem jackoby

Reputation: 22198

For those who faced this issue and are using a script for login:

    config:
      registries:
        - name: Registry Name
          api_url: https://<registry-url>
          prefix: "<registry-url>"
          ping: yes
          default: true
          insecure: no
          credentials: ext:/scripts/registry-login.sh
          credsexpire: 12h
      authScripts:
        enabled: true
        scripts:
          ecr-login.sh: |
            #!/bin/sh
            aws ecr --region "us-east-2" get-authorization-token --output text --query 'authorizationData[].authorizationToken' | base64 -d

Instead of adding the pull-secret in the registry level - try adding the pull-secret annotation in the application level instead:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: my-cool-app
  namespace: argocd
  labels:
    app: my-cool-app
  annotations:
      argocd-image-updater.argoproj.io/image-list: some_alias=<reigstry-url>/imageName
      argocd-image-updater.argoproj.io/some_alias.update-strategy: digest
      argocd-image-updater.argoproj.io/some_alias.pull-secret: ext:/scripts/ecr-login.sh

The best way to understand the issue is to SSH into the image updater container and run ./scripts/<your-script-name> and see the error or try to run the command in the script directly.

Upvotes: 0

e_v_e
e_v_e

Reputation: 631

I had the same issue. In my case the problem was that I was using the test command without specifing the configuration of the registry because I assumed that it will take the default config file, but it doesn't. So try this:

argocd-image-updater test gcr.io/myproject/myimage --registries-conf-path="/app/config/registries.conf"

Or use the command run instead of test

Hope it helps.

Upvotes: 3

Related Questions