Bug 1318537

Summary: Got "unexpected error, from is empty" when importing image from imagestream that only has spec.Tags
Product: OKD Reporter: Wei Sun <wsun>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED CURRENTRELEASE QA Contact: Wei Sun <wsun>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, mmccomas
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 17:09:14 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 Wei Sun 2016-03-17 07:39:42 UTC
Description of problem:
Created an imagestream that only has spec.Tags,and imported image from the imagestream.But got "error: unexpected error, from is empty". 
But in fact in my imagestream,there is
 "from": {
                    "kind": "DockerImage",
                    "name": "wsun/python-33-centos"
                },

Version-Release number of selected component (if applicable):
# oc version
oc v1.1.4-16-gb5da002
kubernetes v1.2.0-origin-41-g91d3e75

How reproducible:
Always

Steps to Reproduce:
1.Create an imagestream that only has spec.Tags
# cat is.json 
{

    "kind": "ImageStream",
    "apiVersion": "v1",
    "metadata": {
      "name": "python",
      "creationTimestamp": null
    },
    "spec": {
           "tags":[
                      { "name": "3.3",
                         "annotations":
                              { "description": "wsun tests" },
                          "from":
                           {
                               "kind": "DockerImage",
                                "name": "wsun/python-33-centos"
                           }

                        }
             ]
       }

}

2.import image from imagestream
3.

Actual results:
2.]# oc import-image python --loglevel=8
I0317 03:35:53.893931    8130 loader.go:242] Config loaded from file /root/.kube/config
I0317 03:35:53.894342    8130 round_trippers.go:264] GET https://localhost:8443/api
I0317 03:35:53.894350    8130 round_trippers.go:271] Request Headers:
I0317 03:35:53.894354    8130 round_trippers.go:274]     Accept: application/json, */*
I0317 03:35:53.894359    8130 round_trippers.go:274]     Authorization: Bearer Tk8WgBz4iRN_tAUCtQGDt3KK8V8OXydpOFlELu3n4lc
I0317 03:35:53.912614    8130 round_trippers.go:289] Response Status: 200 OK in 18 milliseconds
I0317 03:35:53.912628    8130 round_trippers.go:292] Response Headers:
I0317 03:35:53.912634    8130 round_trippers.go:295]     Cache-Control: no-store
I0317 03:35:53.912639    8130 round_trippers.go:295]     Content-Type: application/json
I0317 03:35:53.912643    8130 round_trippers.go:295]     Date: Thu, 17 Mar 2016 07:35:53 GMT
I0317 03:35:53.912648    8130 round_trippers.go:295]     Content-Length: 69
I0317 03:35:53.912683    8130 request.go:875] Response Body: {"kind":"APIVersions","apiVersion":"v1","versions":["v1","v1beta3"]}
I0317 03:35:53.912868    8130 round_trippers.go:264] GET https://localhost:8443/apis
I0317 03:35:53.912875    8130 round_trippers.go:271] Request Headers:
I0317 03:35:53.912880    8130 round_trippers.go:274]     Accept: application/json, */*
I0317 03:35:53.912884    8130 round_trippers.go:274]     Authorization: Bearer Tk8WgBz4iRN_tAUCtQGDt3KK8V8OXydpOFlELu3n4lc
I0317 03:35:53.913891    8130 round_trippers.go:289] Response Status: 200 OK in 0 milliseconds
I0317 03:35:53.913904    8130 round_trippers.go:292] Response Headers:
I0317 03:35:53.913909    8130 round_trippers.go:295]     Cache-Control: no-store
I0317 03:35:53.913913    8130 round_trippers.go:295]     Content-Type: application/json
I0317 03:35:53.913918    8130 round_trippers.go:295]     Date: Thu, 17 Mar 2016 07:35:53 GMT
I0317 03:35:53.913922    8130 round_trippers.go:295]     Content-Length: 223
I0317 03:35:53.913937    8130 request.go:875] Response Body: {"kind":"APIGroupList","apiVersion":"v1","groups":[{"name":"extensions","versions":[{"groupVersion":"extensions/v1beta1","version":"v1beta1"}],"preferredVersion":{"groupVersion":"extensions/v1beta1","version":"v1beta1"}}]}
I0317 03:35:53.914383    8130 round_trippers.go:264] GET https://localhost:8443/oapi
I0317 03:35:53.914394    8130 round_trippers.go:271] Request Headers:
I0317 03:35:53.914399    8130 round_trippers.go:274]     Accept: application/json, */*
I0317 03:35:53.914403    8130 round_trippers.go:274]     User-Agent: oc/v1.1.4 (linux/amd64) openshift/b5da002
I0317 03:35:53.914407    8130 round_trippers.go:274]     Authorization: Bearer Tk8WgBz4iRN_tAUCtQGDt3KK8V8OXydpOFlELu3n4lc
I0317 03:35:53.915345    8130 round_trippers.go:289] Response Status: 200 OK in 0 milliseconds
I0317 03:35:53.915357    8130 round_trippers.go:292] Response Headers:
I0317 03:35:53.915363    8130 round_trippers.go:295]     Cache-Control: no-store
I0317 03:35:53.915367    8130 round_trippers.go:295]     Content-Type: application/json
I0317 03:35:53.915372    8130 round_trippers.go:295]     Date: Thu, 17 Mar 2016 07:35:53 GMT
I0317 03:35:53.915376    8130 round_trippers.go:295]     Content-Length: 59
I0317 03:35:53.915391    8130 request.go:875] Response Body: {"kind":"APIVersions","apiVersion":"v1","versions":["v1"]}
I0317 03:35:53.915558    8130 round_trippers.go:264] GET https://localhost:8443/oapi/v1/namespaces/wsun/imagestreams/python
I0317 03:35:53.915565    8130 round_trippers.go:271] Request Headers:
I0317 03:35:53.915569    8130 round_trippers.go:274]     Accept: application/json, */*
I0317 03:35:53.915573    8130 round_trippers.go:274]     User-Agent: oc/v1.1.4 (linux/amd64) openshift/b5da002
I0317 03:35:53.915577    8130 round_trippers.go:274]     Authorization: Bearer Tk8WgBz4iRN_tAUCtQGDt3KK8V8OXydpOFlELu3n4lc
I0317 03:35:53.917320    8130 round_trippers.go:289] Response Status: 200 OK in 1 milliseconds
I0317 03:35:53.917333    8130 round_trippers.go:292] Response Headers:
I0317 03:35:53.917338    8130 round_trippers.go:295]     Cache-Control: no-store
I0317 03:35:53.917343    8130 round_trippers.go:295]     Content-Type: application/json
I0317 03:35:53.917347    8130 round_trippers.go:295]     Date: Thu, 17 Mar 2016 07:35:53 GMT
I0317 03:35:53.917351    8130 round_trippers.go:295]     Content-Length: 876
I0317 03:35:53.917375    8130 request.go:875] Response Body: {"kind":"ImageStream","apiVersion":"v1","metadata":{"name":"python","namespace":"wsun","selfLink":"/oapi/v1/namespaces/wsun/imagestreams/python","uid":"5cfbac74-ec0e-11e5-8e84-0e057fb684c9","resourceVersion":"372","generation":2,"creationTimestamp":"2016-03-17T07:03:33Z","annotations":{"openshift.io/image.dockerRepositoryCheck":"2016-03-17T07:03:34Z"}},"spec":{"tags":[{"name":"3.3","annotations":{"description":"wsun tests"},"from":{"kind":"DockerImage","name":"wsun/python-33-centos"},"generation":2,"importPolicy":{}}]},"status":{"dockerImageRepository":"172.30.3.20:5000/wsun/python","tags":[{"tag":"3.3","items":[{"created":"2016-03-17T07:03:34Z","dockerImageReference":"wsun/python-33-centos@sha256:354d212f9a8c776a221487f4223211103f2e0c4d42ea97eeae6091523acff3ef","image":"sha256:354d212f9a8c776a221487f4223211103f2e0c4d42ea97eeae6091523acff3ef","generation":2}]}]}}
F0317 03:35:53.917849    8130 helpers.go:107] error: unexpected error, from is empty


Expected results:
Could import image successfully

Additional info:
If I use --from=wsun/python-33-centos , then I could import image successfully.And after that,even if I don't use --from any more,import-image command still work.

Comment 1 Maciej Szulik 2016-03-18 11:03:14 UTC
The problem is that when you don't specify tag 'latest' is being use. Since you don't have latest defined it's failing. I've fixed the error message to be clear that there's no such tag defined see https://github.com/openshift/origin/pull/8117

Comment 2 openshift-github-bot 2016-03-20 17:21:18 UTC
Commits pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/6e84e1ff27cba9358110dd83c226c0b492cd5dd2
Bug 1318537 - Add warning when trying to import non-existing tag

https://github.com/openshift/origin/commit/2ddfc71bf4f24d35afbf4085b1e26ae64bffa107
Merge pull request #8117 from soltysh/bug1318537

Merged by openshift-bot

Comment 3 Wei Sun 2016-03-21 06:31:15 UTC
Verified this bug with the latest code.

Result:
# oc import-image python33
error: the tag "latest" does not exist on the image stream - choose an existing tag to import or use the 'tag' command to create a new tag


# oc import-image python33:3.3
The import completed successfully.

Name:			python33
Created:		2 minutes ago
Labels:			<none>
Annotations:		openshift.io/image.dockerRepositoryCheck=2016-03-21T06:16:02Z
Docker Pull Spec:	172.30.123.14:5000/wsuntest/python33

Tag	Spec			Created		PullSpec					Image
3.3	wsun/python-33-centos	2 minutes ago	wsun/python-33-centos@sha256:354d212f9a8c77...	<same>