Bug 1770144 - Cannot recognize image tag when run oc new-app with namespace after --imagestream
Summary: Cannot recognize image tag when run oc new-app with namespace after --images...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.3.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.3.0
Assignee: Maciej Szulik
QA Contact: Wenjing Zheng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-08 10:02 UTC by Wenjing Zheng
Modified: 2020-01-23 11:12 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-23 11:11:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 160 0 'None' 'closed' 'Bug 1770144: fix imagestream parsing to properly split its namespace part' 2019-11-25 07:46:21 UTC
Red Hat Bugzilla 1767163 0 unspecified CLOSED new-app with imagestream results in bad k8s labels 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2020:0062 0 None None None 2020-01-23 11:12:03 UTC

Description Wenjing Zheng 2019-11-08 10:02:14 UTC
Description of problem:
Below error appears when try to oc new-app with mongodb:latest or mongodb:3.6:
$ oc new-app --image-stream=mongodb:latest --env=MONGODB_USER=tester --env=MONGODB_PASSWORD=xxx --env=MONGODB_DATABASE=testdb --env=MONGODB_ADMIN_PASSWORD=yyy
--> Found image f857d36 (4 weeks old) in image stream "openshift/mongodb" under tag "latest" for "openshift/mongodb:latest"

    MongoDB 3.6 
    ----------- 
    MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. This container image contains programs to run mongod server.

    Tags: database, mongodb, rh-mongodb36

    * This image will be deployed in deployment config "mongodb"
    * Port 27017/tcp will be load balanced by service "mongodb"
      * Other containers can access this service through the hostname "mongodb"
    * This image declares volumes and will default to use non-persistent, host-local storage.
      You can add persistent volumes later by running 'oc set volume dc/mongodb --add ...'

--> Creating resources ...
    error: ImageStreamTag.image.openshift.io "mongodb:latest" is invalid: metadata.labels: Invalid value: "openshift/mongodb:latest": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
    error: DeploymentConfig.apps.openshift.io "mongodb" is invalid: metadata.labels: Invalid value: "openshift/mongodb:latest": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
    error: Service "mongodb" is invalid: metadata.labels: Invalid value: "openshift/mongodb:latest": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
--> Failed

No such issue when run oc new-app without tag defined.

Version-Release number of selected component (if applicable):
Client Version: v4.3.0
Server Version: 4.3.0-0.nightly-2019-11-07-172437
Kubernetes Version: v1.16.2


How reproducible:
Always

Steps to Reproduce:
1.oc new-app --image-stream=mongodb:latest --env=MONGODB_USER=tester --env=MONGODB_PASSWORD=xxx --env=MONGODB_DATABASE=testdb --env=MONGODB_ADMIN_PASSWORD=yyy
2.
3.

Actual results:
Command fail.

Expected results:
Should succeed like 4.1 version:
[wzheng@openshift-qe 4.1.z]$ ./oc new-app --image-stream=openshift/mongodb:latest --env=MONGODB_USER=tester --env=MONGODB_PASSWORD=xxx --env=MONGODB_DATABASE=testdb --env=MONGODB_ADMIN_PASSWORD=yyy --name=mydb
--> Found image f857d36 (4 weeks old) in image stream "openshift/mongodb" under tag "latest" for "openshift/mongodb:latest"

    MongoDB 3.6 
    ----------- 
    MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. This container image contains programs to run mongod server.

    Tags: database, mongodb, rh-mongodb36

    * This image will be deployed in deployment config "mydb"
    * Port 27017/tcp will be load balanced by service "mydb"
      * Other containers can access this service through the hostname "mydb"
    * This image declares volumes and will default to use non-persistent, host-local storage.
      You can add persistent volumes later by running 'oc set volume dc/mydb --add ...'

--> Creating resources ...
    imagestreamtag.image.openshift.io "mydb:latest" created
    deploymentconfig.apps.openshift.io "mydb" created
    service "mydb" created
--> Success
    Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
     'oc expose svc/mydb' 
    Run 'oc status' to view your app.
[wzheng@openshift-qe 4.1.z]$ ./oc version
Client Version: version.Info{Major:"4", Minor:"1+", GitVersion:"v4.1.23-201911050122+26eb389-dirty", GitCommit:"26eb389", GitTreeState:"dirty", BuildDate:"2019-11-05T08:31:35Z", GoVersion:"go1.11.13", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.4+5b8586a", GitCommit:"5b8586a", GitTreeState:"clean", BuildDate:"2019-11-05T08:31:29Z", GoVersion:"go1.11.13", Compiler:"gc", Platform:"linux/amd64"}
[wzheng@openshift-qe 4.1.z]$ ./oc version --short
Client Version: v4.1.23-201911050122+26eb389-dirty
Server Version: v1.13.4+5b8586a


Additional info:

Comment 1 Adam Kaplan 2019-11-11 21:02:52 UTC
How did this fail and the fix for Bug #1767163 pass? Please make sure that the version of oc used to test is aligned with the server version.

Comment 2 Wenjing Zheng 2019-11-12 01:47:42 UTC
(In reply to Adam Kaplan from comment #1)
> How did this fail and the fix for Bug #1767163 pass? Please make sure that
> the version of oc used to test is aligned with the server version.

After upgrade to latest oc, cannot reproduce this bug now, sorry for the confusion:
[wzheng@openshift-qe 4.3]$ oc new-app --image-stream=mongodb:3.6 --env=MONGODB_USER=tester --env=MONGODB_PASSWORD=xxx --env=MONGODB_DATABASE=testdb --env=MONGODB_ADMIN_PASSWORD=yyy
--> Found image f857d36 (4 weeks old) in image stream "openshift/mongodb" under tag "3.6" for "mongodb:3.6"

    MongoDB 3.6 
    ----------- 
    MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. This container image contains programs to run mongod server.

    Tags: database, mongodb, rh-mongodb36

    * This image will be deployed in deployment config "mongodb"
    * Port 27017/tcp will be load balanced by service "mongodb"
      * Other containers can access this service through the hostname "mongodb"
    * This image declares volumes and will default to use non-persistent, host-local storage.
      You can add persistent volumes later by running 'oc set volume dc/mongodb --add ...'

--> Creating resources ...
    imagestreamtag.image.openshift.io "mongodb:3.6" created
    deploymentconfig.apps.openshift.io "mongodb" created
    service "mongodb" created
--> Success
    Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
     'oc expose svc/mongodb' 
    Run 'oc status' to view your app.
[wzheng@openshift-qe 4.3]$ oc version
Client Version: v4.3.0
Server Version: 4.3.0-0.nightly-2019-11-11-182924
Kubernetes Version: v1.16.2

Comment 3 Wenjing Zheng 2019-11-13 07:13:52 UTC
Reopen this bug since if add openshift before imagestream "--image-stream=openshift/mongodb:latest", still failed:
$ oc new-app --image-stream=openshift/mongodb:latest --env=MONGODB_USER=tester --env=MONGODB_PASSWORD=xxx --env=MONGODB_DATABASE=testdb --env=MONGODB_ADMIN_PASSWORD=yyy
--> Found image f857d36 (4 weeks old) in image stream "openshift/mongodb" under tag "latest" for "openshift/mongodb:latest"

    MongoDB 3.6 
    ----------- 
    MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. This container image contains programs to run mongod server.

    Tags: database, mongodb, rh-mongodb36

    * This image will be deployed in deployment config "mongodb"
    * Port 27017/tcp will be load balanced by service "mongodb"
      * Other containers can access this service through the hostname "mongodb"
    * This image declares volumes and will default to use non-persistent, host-local storage.
      You can add persistent volumes later by running 'oc set volume dc/mongodb --add ...'

--> Creating resources ...
    error: ImageStreamTag.image.openshift.io "mongodb:latest" is invalid: metadata.labels: Invalid value: "openshift/mongodb": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
    error: DeploymentConfig.apps.openshift.io "mongodb" is invalid: metadata.labels: Invalid value: "openshift/mongodb": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
    error: Service "mongodb" is invalid: metadata.labels: Invalid value: "openshift/mongodb": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
--> Failed

Comment 4 Wenjing Zheng 2019-11-13 07:14:15 UTC
$ oc version
Client Version: v4.3.0
Server Version: 4.3.0-0.nightly-2019-11-12-185229
Kubernetes Version: v1.16.2

Comment 6 Wenjing Zheng 2019-11-19 05:41:58 UTC
Verified with latest oc version:
openshift-clients.x86_64 0:4.3.0-201911150628.git.1.bfb5907.el7

Comment 8 errata-xmlrpc 2020-01-23 11:11:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0062


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