Bug 1372253

Summary: Registry fails to serve imported manifest of schema 2 to old client
Product: OKD Reporter: zhou ying <yinzhou>
Component: Image RegistryAssignee: Michal Minar <miminar>
Status: CLOSED CURRENTRELEASE QA Contact: Wei Sun <wsun>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.xCC: aos-bugs, miminar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-09 21:51:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description zhou ying 2016-09-01 09:16:13 UTC
Description of problem:
Manifest V2 schema 2 refers to a special blob by a digest. The blob is a config file which used to be embedded in manifest V2 schema 1. During an image import, the config file is stored in image object. Registry storage is not modified. When such an image is pulled by older client (supporting just manifest V2 schema 1), the registry attempts to convert schema 2 fetched from etcd to schema 1. For this it needs the config file. It attempts to load it from registry's storage and fails.

Version-Release number of selected component (if applicable):
openshift v1.3.0-alpha.3+3fc2c7c-dirty
kubernetes v1.3.0+507d3a7

docker:

Server:
 Version:         1.9.1
 API version:     1.21
 Package version: docker-common-1.9.1-40.el7.x86_64
 Go version:      go1.4.2
 Git commit:      ab77bde/1.9.1

How reproducible:
always

Steps To Reproduce
1. deploy registry
2. login as a user U and start a new project P
3. tag some remote image of schema 2: 
   `oc tag --source docker docker.io/busybox:latest busybox:latest`
4. login to docker 1.9 with U's token
5. manually pull the image: 
   `docker pull ${REGISTRY_URL}/P/busybox:latest`

Current Result
Trying to pull repository 172.30.241.183:5000/pjoe/busybox ... failed
manifest invalid: manifest invalid

Expected Result
Successful pull.

Additional Information
This case should be handled by pullthroughmiddleware. The middleware needs to override Get() method.
A case where imagestreamimage is tagged to another repository/namespace needs to be tested as well.

Comment 1 Michal Minar 2016-09-01 10:37:15 UTC
Related P1 issue:

https://github.com/openshift/origin/issues/10730

Comment 2 Michal Minar 2016-09-01 12:28:19 UTC
Work In Progress fix: https://github.com/openshift/origin/pull/10759

Comment 3 Michal Minar 2016-09-06 12:34:30 UTC
[merged]

Comment 4 zhou ying 2016-09-08 01:43:23 UTC
Confirmed with latest OCP , the issue has fixed:
openshift version
openshift v3.3.0.30
kubernetes v1.3.0+52492b4
etcd 2.3.0+git


[root@dhcp-136-93 ~]# docker login -u zhouy -p qo3lU-GFXci_ZtzpgJA8J5G72Tviy6mtonuj7Ssol44 -e dald docker-registry-default.0908-gse.qe.rhcloud.com
WARNING: login credentials saved in /root/.docker/config.json
Login Succeeded
[root@dhcp-136-93 ~]# docker pull docker-registry-default.0908-gse.qe.rhcloud.com/zhouy/busybox
Using default tag: latest
latest: Pulling from zhouy/busybox
a5d4c53980c6: Pull complete 
b41c5284db84: Pull complete 
Digest: sha256:6ce747b550bac41c2c779f1d20fb7bcd0d3195996f101f3f0d378bc7bf5333b6

[root@dhcp-136-93 ~]# docker version
Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:34:39 UTC 2015
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:34:39 UTC 2015
 OS/Arch:      linux/amd64

Comment 5 zhou ying 2016-09-18 09:55:20 UTC
Check on with fork_ami_openshift3_miminar_302, the issue has fixed :
    [root@openshift-194 ~]# docker pull registry-default.router.default.svc.cluster.local/zhouy/busybox
    Using default tag: latest
    Trying to pull repository registry-default.router.default.svc.cluster.local/zhouy/busybox ... latest: Pulling from zhouy/busybox
    a5d4c53980c6: Pull complete
    b41c5284db84: Pull complete
    Digest: sha256:6ce747b550bac41c2c779f1d20fb7bcd0d3195996f101f3f0d378bc7bf5333b6
    Status: Downloaded newer image for registry-default.router.default.svc.cluster.local/zhouy/busybox:latest
     
    [root@openshift-194 ~]# docker version
    Client:
     Version:         1.9.1
     API version:     1.21
     Package version: docker-common-1.9.1-40.el7.x86_64
     Go version:      go1.4.2
     Git commit:      ab77bde/1.9.1
     Built:          
     OS/Arch:         linux/amd64
     
    Server:
     Version:         1.9.1
     API version:     1.21
     Package version: docker-common-1.9.1-40.el7.x86_64
     Go version:      go1.4.2
     Git commit:      ab77bde/1.9.1
     Built:          
     OS/Arch:         linux/amd64
    [root@openshift-194 ~]# docker images
    REPOSITORY                                                        TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
    registry-default.router.default.svc.cluster.local/zhouy/busybox   latest              b41c5284db84        12 weeks ago        1.093 MB