argocd-image-updater icon indicating copy to clipboard operation
argocd-image-updater copied to clipboard

Docker Hub default namespace is removed on write back

Open AlessandroZanatta opened this issue 10 months ago • 2 comments

Is your feature request related to a problem? Please describe. I would like to be able to specify every image name as a fully qualified name, that is, registry.url/namespace/imagename:tag.

However, this is not possible for docker.io/library/<...>, as the library/ part gets removed here (I think).

When using git write-back-method and the kustomization write-back-target, that is:

    argocd-image-updater.argoproj.io/write-back-method: git
    argocd-image-updater.argoproj.io/write-back-target: kustomization

it results in the following kustomization update:

images:
  - name: docker.io/postgres
    newTag: 16.6-alpine

which does not match the image tag in the pod, such as docker.io/library/postgres:16-alpine, hence the pod is not rolled to the new image by argocd.

Describe the solution you'd like Would it be possible to avoid removing the default namespace? The comment here does not specify why this gets removed, could you please clarify? If it's something that can be fixed, I'd be happy to send a PR for it!

I've also tried specifying the Docker Hub registry in the configuration with a blank defaultNs, but that resulted in errors from the registry:

time="2025-01-14T08:42:37+01:00" level=error msg="Could not get tags from registry: errors:\ndenied: requested access to the resource is denied\nunauthorized: authentication required\n" alias=postgres application=anime image_name=postgres image_tag=16-alpine registry=docker.io

I do not see a way to enforce retaining the library part in the image name in the docs (unless I missed it, that is).

Describe alternatives you've considered The alternative is leaving the library/ part out of the image names, which I do not particularly like given that all the other images are fully qualified.

Additional context I think it's a pretty niche feature, but also a slight improvement that could be added to this amazing project!

AlessandroZanatta avatar Jan 14 '25 21:01 AlessandroZanatta

I guess library/ is removed for the sake of brevity, since this is a default namespace value that users don't have to specify. And also the removal is conditional. Maybe we can improve the condition to cover your case, e.g., when library/ is in the middle of the string not as a prefix.

chengfang avatar Jan 16 '25 01:01 chengfang

For some more context, https://github.com/argoproj-labs/argocd-image-updater/pull/275 was the PR that introduced it and it had some discussions around exactly that piece of logic.

jannfis avatar Jan 16 '25 03:01 jannfis

Looks like library/ is removed when trying to access my local harbor registry, making this not work at all.

What even is the point of stripping away library/ to begin with? docker hub works fine with it there.

R0flcopt3r avatar Jul 04 '25 08:07 R0flcopt3r

Looks like library/ is removed when trying to access my local harbor registry, making this not work at all.

What even is the point of stripping away library/ to begin with? docker hub works fine with it there.

The PR above fixed it for docker.io. It should be pretty easy to fix it for any other registry.

In the past, I've run a locally patched version since the PR was not being merged at all after months. Currently, I've moved to Renovate.

Hope this helps!

AlessandroZanatta avatar Jul 04 '25 08:07 AlessandroZanatta