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

Mapping docker.io to localhost incorrectly prepends new host twice #55

Open
sblair-metrostar opened this issue Sep 9, 2021 · 2 comments
Labels
bug Something isn't working python

Comments

@sblair-metrostar
Copy link

sblair-metrostar commented Sep 9, 2021

What happened:
I tried mapping docker.io to my local Harbor pull cache project, which resulted in the mapped host appearing twice in the pod container image.

example/image -> localhost:30003/dockerhub/localhost:30003/dockerhub/example/image

What you expected to happen:
The substitution should only happen once.

example/image -> localhost:30003/dockerhub/example/image

How to reproduce it (as minimally and precisely as possible):
I don't believe the port is relevant here, but still using the locally hacked version to get around that until the next release with the :: change.

default:
docker.io:localhost:30003/dockerhub

Anything else we need to know?:
I figured maybe adding an empty entry for localhost: would have been enough to override the second pass which was apparently triggered according to the logs, but that didn't work. Looks like this will happen for any target host that doesn't have a . in it, just not sure that will ever be an issue for anything other than localhost. I was able to get a hack working to bypass the issue for now.

if "." in image_split[0] and image_split[1] != "" and image_split[2] != "":

if "." in image_split[0] and image_split[1] != "" and image_split[2] != "":
    image_registry = image_split[0]
elif image_split[0].lower().startswith("localhost"):
    image_registry = image_split[0]
else:
    # Set docker.io if no registry is detected
    image_registry = "docker.io"
    no_registry = True

Environment:

  • Kubernetes version (use kubectl version): 1.20
  • Cloud provider or hardware configuration: AWS/EKS
  • Others:
@sblair-metrostar sblair-metrostar added the bug Something isn't working label Sep 9, 2021
@sblair-metrostar
Copy link
Author

Actually just occurred to me after submitting this bug that using 127.0.0.1 might be another viable workaround. I'll give that a try and see how it goes.

@phenixblue
Copy link
Owner

I think we can add a check specifically for localhost to solve for this scenario.

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

No branches or pull requests

2 participants