-
Couldn't load subscription status.
- Fork 62
lib/common: update ParseDockerURL
#250
Conversation
When testing rktlet with k8s `v1.8.0-beta.1`, `PullImage` currently fails because the kubelet sends a full image name (e.g. `docker.io/library/busybox`) instead of an abbreviated one (e.g. `busybox`). This is probably due to a regression in k8s; see also kubernetes/kubernetes#52110 By updating `github.com/docker/distribution/reference`, we can use new helpers to parse and harmonize names. With that, docker2aci now also can handle URLs with the default index domain (`docker.io`) in it, for example `docker://docker.io/library/busybox`. Before, that resulted in `Error: conversion error: registry doesn't support API v2 nor v1`, as `docker.io` doesn't point to a registry API. ``` docker://busybox docker://library/busybox docker://docker.io/library/busybox # didn't work before ``` This works because `docker.io` as the default index domain gets stripped from a familiarized name and thus docker2aci uses registry-1.docker.io instead: https://github.com/docker/distribution/blob/5db89f0ca68677abc5eefce8f2a0a772c98ba52d/reference/normalize.go#L90-L91
|
Can you please add some basic unit testing to this? Also, does this introduce a delta in the generated image manifest of the final ACI, compared to previous behavior? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
yep, unit testing would be good :) |
|
Just for the sake of clarity, the image-manifest delta I'm worried about is for the following cases:
|
|
Updated with unit tests.
I compared the manifest for the following Docker URLs for master + PR:
The only difference is in |
e3f07cc to
53aa61e
Compare
|
AFAICS, I'm fine with merging this. Any other concerns, @lucab? |
|
@iaguis Not really. I was asking about the originalname because rkt relies on that to avoid keeping multiple converted ACIs for the same docker image when shorthand names are used |
|
That's what I see for Should it be the same |
|
@schu no, that delta is fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Ok, thanks! |
When testing rktlet with k8s
v1.8.0-beta.1,PullImagecurrentlyfails because the kubelet sends a full image name (e.g.
docker.io/library/busybox) instead of an abbreviated one (e.g.busybox). This is probably due to a regression in k8s; see alsokubernetes/kubernetes#52110
By updating
github.com/docker/distribution/reference, we can use newhelpers to parse and harmonize names. With that, docker2aci now also can
handle URLs with the default index domain (
docker.io) in it, forexample
docker://docker.io/library/busybox. Before, that resulted inError: conversion error: registry doesn't support API v2 nor v1, asdocker.iodoesn't point to a registry API.This works because
docker.ioas the default index domain gets strippedfrom a familiarized name and thus docker2aci uses registry-1.docker.io
instead:
https://github.com/docker/distribution/blob/5db89f0ca68677abc5eefce8f2a0a772c98ba52d/reference/normalize.go#L90-L91