Skip to content

Conversation

@iamnoah
Copy link
Contributor

@iamnoah iamnoah commented Oct 12, 2021

fixes #273

Copy link
Contributor

@jannfis jannfis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @iamnoah, thanks a lot for this fix!

LGTM so far, with one fixable and one concern:

  1. Please fix the go import to satisfy the linter:)
  2. A question/request for change, please see below

img := ContainerImage{}
img.RegistryURL = reference.Domain(parsed)
// remove default registry for backwards-compatibility
if img.RegistryURL == "docker.io" && !strings.HasPrefix(imgRef, "docker.io") {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jannfis this was my workaround. If docker.io was explicity the registry, retain it, else remove it. Is there a case I’m missing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, now I got it. Sorry, I was a little confused and missed the check for the prefix on original image ref.

OK, so if the parsed registry domain is docker.io, but the original image ref is not prefixed with docker.io, we assume default registry and set it to blank. Yes, that makes sense and would restore original behavior. Thanks for clarifying it.

@jannfis
Copy link
Contributor

jannfis commented Oct 19, 2021

OK, so I think the last remaining issue is that distribution also takes an assumption on the default repository that is being set if an image is specified without dedicated repository (e.g. just nginx). distribution assumes this being library, as of the Docker Hub implementation.

This is currently also a per-registry configurable in the image updater (see https://argocd-image-updater.readthedocs.io/en/stable/configuration/registries/#configuring-a-custom-container-registry, defaultns parameter). However, library seems to be also the (non-configurable) default for all the registries I have looked at so far. So maybe, we can drop that configurable in favor of the convention. Or apply a similar workaround as for the default registry prefix.

@iamnoah
Copy link
Contributor Author

iamnoah commented Oct 20, 2021

Or apply a similar workaround as for the default registry prefix.

Done.

Copy link
Contributor

@jannfis jannfis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @iamnoah !

@jannfis jannfis merged commit 89b10c1 into argoproj-labs:master Oct 20, 2021
sribiere-jellysmack pushed a commit to sribiere-jellysmack/argocd-image-updater that referenced this pull request Aug 13, 2024
* fix: use distribution to parse references

fixes argoproj-labs#273

* fix: keep docker.io if it was specified

* fix: remove library/ if it was added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Private repos on non-standard ports image update misinterpretation

2 participants