Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 14, 2020. It is now read-only.

Conversation

@schu
Copy link
Contributor

@schu schu commented Sep 18, 2017

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

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
@lucab
Copy link
Contributor

lucab commented Sep 18, 2017

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?

Copy link
Member

@iaguis iaguis left a comment

Choose a reason for hiding this comment

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

lgtm

@iaguis
Copy link
Member

iaguis commented Sep 18, 2017

yep, unit testing would be good :)

@lucab
Copy link
Contributor

lucab commented Sep 18, 2017

Just for the sake of clarity, the image-manifest delta I'm worried about is for the following cases:

  • docker://busybox
  • docker://library/busybox
  • docker://registry-1.docker.io/library/busybox

@schu
Copy link
Contributor Author

schu commented Sep 18, 2017

Updated with unit tests.

Also, does this introduce a delta in the generated image manifest of the final ACI, compared to previous behavior?

I compared the manifest for the following Docker URLs for master + PR:

  • docker://busybox
  • docker://library/busybox
  • docker://registry-1.docker.io/library/busybox
  • docker://docker.io/library/busybox (only with PR)

The only difference is in appc.io/docker/originalname.

@schu schu force-pushed the schu/parse-docker-url branch from e3f07cc to 53aa61e Compare September 18, 2017 13:38
@iaguis
Copy link
Member

iaguis commented Sep 20, 2017

AFAICS, appc.io/docker/originalname is the same as before except that for docker://docker.io/library/busybox it is docker.io/library/busybox and before this wasn't working at all.

I'm fine with merging this. Any other concerns, @lucab?

@lucab
Copy link
Contributor

lucab commented Sep 20, 2017

@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
(or at least that was the plan, I'm not sure if the deduplication code for rkt got merged).

@schu
Copy link
Contributor Author

schu commented Sep 21, 2017

That's what I see for appc.io/docker/originalname for both master and PR version:

docker2aci docker://busybox
=> appc.io/docker/originalname == busybox
docker2aci docker://library/busybox
=> appc.io/docker/originalname == library/busybox
docker2aci docker://docker.io/library/busybox                  # doesn't work with master
=> appc.io/docker/originalname == docker.io/library/busybox
docker2aci docker://registry-1.docker.io/library/busybox
=> appc.io/docker/originalname == registry-1.docker.io/library/busybox

Should it be the same appc.io/docker/originalname for all docker:// URLs?

@lucab
Copy link
Contributor

lucab commented Sep 21, 2017

@schu no, that delta is fine.

Copy link
Contributor

@lucab lucab left a comment

Choose a reason for hiding this comment

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

LGTM

@schu
Copy link
Contributor Author

schu commented Sep 21, 2017

Ok, thanks!

@iaguis iaguis merged commit 5145072 into appc:master Sep 21, 2017
@schu schu deleted the schu/parse-docker-url branch September 21, 2017 08:55
@iaguis iaguis added this to the v0.17.0 milestone Sep 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants