Bug 1327108 - For ImageStreamTag spec.tags, oc import-image fail
Summary: For ImageStreamTag spec.tags, oc import-image fail
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Image Registry
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Maciej Szulik
QA Contact: Wei Sun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-14 09:58 UTC by Xingxing Xia
Modified: 2016-09-19 13:50 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-19 13:50:34 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Xingxing Xia 2016-04-14 09:58:32 UTC
Description of problem:
For ImageStreamTag spec.tags, oc import-image fail and give error: tag already exists - you must use the 'tag' command if you want to change the source to ""

Version-Release number of selected component (if applicable):
openshift v1.1.6-97-gbe0abe5
kubernetes v1.2.0-36-g4a3f9c5
etcd 2.2.5

How reproducible:
Always

Steps to Reproduce:
1. Create a new ImageStream
{
    "kind": "ImageStream",
    "apiVersion": "v1",
    "metadata": {
      "name": "python",
      "creationTimestamp": null
    },
    "spec": {
      "dockerImageRepository": "wsun/python-33-centos"
      }
}

2. Create another ImageStream that references former istag
     {
    "kind": "ImageStream",
    "apiVersion": "v1",
    "metadata": {
      "name": "python27",
      "creationTimestamp": null
     },
    "spec": {
           "tags":[
                      { "name": "3.3",
                         "annotations":
                              { "description": "wsun tests" },
                          "from":
                           {
                               "kind": "ImageStreamTag",
                                "name": "python:3.3"
                           }
                        }
             ]
       }
 }

Then check imagestream:
$ oc get is
python     wsun/python-33-centos                   3.3,latest   12 minutes ago
python27   172.30.25.207:5000/xxia-proj/python27   3.3          12 minutes ago

3. Import image for the 2nd imagestream with tag
$ oc import-image python27:3.3

Actual results:
3. Get error:
error: tag "3.3" already exists - you must use the 'tag' command if you want to change the source to ""

Expected results:
3. That error should not occur.

Additional info:

Comment 1 Bing Li 2016-04-14 10:55:01 UTC
Met similiar issue in "engint" env, below is my imagestream config:

spec:
  dockerImageRepository: bingli7/hello-openshift
  tags:
  - annotations:
      description: jhou tests
      iconClass: icon-ruby
      tags: builder,ruby
      version: "2.0"
    generation: null
    importPolicy: {}
    name: latest
  - annotations: null
    from:
      kind: DockerImage
      name: bingli7/hello-openshift
    generation: null
    importPolicy: {}
    name: t2

Comment 2 Paul Weil 2016-04-14 12:59:49 UTC
@xingxing @bing - import-image does not allow you to update tags that already exist.  However, the error message is not very useful.  Since this is not a regression I am going to mark this as UpcomingRelease.

@xingxing - you should also see that your image tag is already resolved if you do "oc get is python27 -o json"

@bing - you should be able to import your t2 tag fine with oc import-image binglitest:t2.  The latest tag in your yaml has no from.  Adding a from allows me to import the whole stream with oc import-image binglitest

Maciej,

The error message probably needs a little work.

Comment 3 XiaochuanWang 2016-05-16 09:44:56 UTC
After create a new <is:tag> by `oc tag`, it shows the same error result:
$ oc get is
python     wsun/python-33-centos                   3.3,latest   12 minutes ago

$ oc tag python:latest python3:latest
Tag python3:latest set to python@sha256:354d212f9a8c776a221487f4223211103f2e0c4d42ea97eeae6091523acff3ef.

$ oc get is
NAME       DOCKER REPO                              TAGS         UPDATED
python     wsun/python-33-centos                    3.3,latest   35 minutes ago
python3    172.30.46.234:5000/xiaocwan-t/python3    latest       6 minutes ago

$ oc import-image python3:latest
error: tag "latest" already exists - you must use the 'tag' command if you want to change the source to ""

I wonder if it needs a new case to cover, suggest to check it again after fixed.
But it's not reproduced if tag from --source=docker

Comment 4 Michal Fojtik 2016-05-24 16:13:55 UTC
Maciej, bump

Comment 5 Maciej Szulik 2016-05-25 11:45:10 UTC
oc import-image will work only for tags pointing to DockerImage, nothing else. I've updated the error to be more descriptive: https://github.com/openshift/origin/pull/9021

Comment 6 openshift-github-bot 2016-06-15 12:43:56 UTC
Commits pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/4ab49cae7465d86660c0af04e214e59372769c5f
Bug 1327108 - Updated error information when trying to import
ImageStream pointing to a different one

https://github.com/openshift/origin/commit/b095e3a489aa6dd534769b333201f1e2b606f2d0
Merge pull request #9021 from soltysh/bug1327108

Merged by openshift-bot

Comment 7 Xingxing Xia 2016-06-16 09:58:11 UTC
Tested with openshift/oc v1.3.0-alpha.1-379-g662753c. Steps:
1 $ oc import-image python27
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
2 $ oc import-image python27:3.3
error: tag "3.3" points to existing ImageStreamTag "python:3.3", it cannot be re-imported

The issue about error message is fixed.

But, the UX is a bit of not perfect. From the above two continuous command executions, step 1 prompts user "choose an existing tag to import" then user executes step 2 according to the prompt (user may be expecting success) but step 2 again offers error (though the error is expected).

How do you think this?

BTW, another problem, about inconsistency:
3 $ oc import-image python:notexist
The import completed successfully.
...

Tag		Spec				Created		PullSpec					Image
latest		wsun/python-33-centos:latest	29 minutes ago	wsun/python-33-centos@sha256:354d212f9a8c77...	<same>
...
notexist	wsun/python-33-centos		1 seconds ago	wsun/python-33-centos@sha256:354d212f9a8c77...	<same>
4 $ oc edit is python # Under 'spec', remove dockerImageRepository: wsun/python-33-centos
imagestream "python" edited
5 $ oc import-image python:none
error: the tag "none" does not exist on the image stream - choose an existing tag to import or use the 'tag' command to create a new tag

Step 1, 3, 5, expose inconsistent message when specifying not existent tag. Do we need some fix?

Thank you!

Comment 8 Maciej Szulik 2016-06-16 12:04:52 UTC
1 and 5 are consistent and are ok. I'm not quite sure what is the state of ImageStream in step 3 when you're invoking oc import-image python:notexist so I'm not sure what to expect. Can you explain a bit?

Comment 9 Xingxing Xia 2016-06-16 14:19:32 UTC
Yeah, comment 7 intended to say step 3 and 5 inconsistent (not 1, 3, 5).

Just before step 3 of comment 7, is/python is in state after 'oc create -f' the json of step 1 in comment 0 (description).

Comment 10 Xingxing Xia 2016-06-20 01:25:45 UTC
VERIFIED this bug. If it is not working by design, I'd like to open another bug to track the issue in comment 7. Rewrite the whole steps here:
1. Create a new ImageStream
$ cat python.json
{
    "kind": "ImageStream",
    "apiVersion": "v1",
    "metadata": {
      "name": "python",
      "creationTimestamp": null
    },
    "spec": {
      "dockerImageRepository": "wsun/python-33-centos"
      }
}

$ oc create -f python.json

2. Import image with a non-existent tag:
$ oc import-image python:notexist
The import completed successfully.
...

Tag		Spec				Created		PullSpec					Image
latest		wsun/python-33-centos:latest	29 minutes ago	wsun/python-33-centos@sha256:354d212f9a8c77...	<same>
...
notexist	wsun/python-33-centos		1 seconds ago	wsun/python-33-centos@sha256:354d212f9a8c77...	<same>

3 $ oc edit is python # Under 'spec', remove dockerImageRepository: wsun/python-33-centos
imagestream "python" edited

4 Try import-image with non-existent tag again:
$ oc import-image python:none
error: the tag "none" does not exist on the image stream - choose an existing tag to import or use the 'tag' command to create a new tag

For a non-existent tag, step 2 succeeds and step 4 shows error. Not sure if this works by design. Please confirm :)

Comment 11 Maciej Szulik 2016-06-20 10:17:46 UTC
I'm ok with a new bug for the separate issue, it'll be easier to track. Please include all the details in the description of the new bug.

Comment 12 Xingxing Xia 2016-06-20 10:39:40 UTC
Thanks. See bug 1348174


Note You need to log in before you can comment on or make changes to this bug.