Bug 1419849

Summary: No service create when use 'new-app' create perl and mysql apps
Product: OpenShift Container Platform Reporter: XiuJuan Wang <xiuwang>
Component: BuildAssignee: Ben Parees <bparees>
Status: CLOSED CURRENTRELEASE QA Contact: Wang Haoran <haowang>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.5.0CC: aos-bugs, tdawson, xiuwang
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: 2017-03-09 04:09:19 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:
Embargoed:
Attachments:
Description Flags
new-app log
none
imagestream of perl none

Description XiuJuan Wang 2017-02-07 08:56:23 UTC
Description of problem:
No service create when use'new-app' create perl and mysql apps, other images have created service.

Version-Release number of selected component (if applicable):
openshift v3.5.0.17+c55cf2b

How reproducible:
always

Steps to Reproduce:
1.Create a perl app
#oc new-app --image-stream=openshift/perl --code=https://github.com/openshift/sti-perl --context-dir=5.20/test/sample-test-app/
2.Create a mysql app
#oc new-app  --image-stream=openshift/mysql -env=MYSQL_ROOT_PASSWORD\=test
3.

Actual results:
#oc new-app --image-stream=openshift/perl --code=https://github.com/openshift/sti-perl --context-dir=5.20/test/sample-test-app/
--> Creating resources with label app=test-perl ...
    imagestream "sti-perl" created
    buildconfig "sti-perl" created
    deploymentconfig "sti-perl" created
--> Success

#oc new-app  --image-stream=openshift/mysql -env=MYSQL_ROOT_PASSWORD\=tes
--> Creating resources ...
    deploymentconfig "mysql" created
--> Success

Expected results:
Should create service

Additional info:

Comment 1 Ben Parees 2017-02-07 16:23:17 UTC
worked ok for me.  The reason this might happen is if for some reason the image metadata indicates the image has no PORT exposures.

Can you rerun new-app with --loglevel=8 and provide the logs?

also the output of "oc get is -n openshift -o yaml" would be helpful.

Comment 2 Ben Parees 2017-02-07 16:26:12 UTC
also your output looks stale(or perhaps you just cut off the top of the output), can you confirm the oc version you are using?

here is my output for comparison:

$ oc new-app --image-stream=openshift/perl --code=https://github.com/openshift/sti-perl --context-dir=5.20/test/sample-test-app/
--> Found image 733dc38 (3 weeks old) in image stream "openshift/perl" under tag "5.24" for "openshift/perl"

    Apache 2.4 with mod_perl/5.24 
    ----------------------------- 
    Platform for building and running Perl 5.24 applications

    Tags: builder, perl, perl524

    * The source repository appears to match: perl
    * A source build using source code from https://github.com/openshift/sti-perl will be created
      * The resulting image will be pushed to image stream "sti-perl:latest"
      * Use 'start-build' to trigger a new build
    * This image will be deployed in deployment config "sti-perl"
    * Port 8080/tcp will be load balanced by service "sti-perl"
      * Other containers can access this service through the hostname "sti-perl"

--> Creating resources ...
    imagestream "sti-perl" created
    buildconfig "sti-perl" created
    deploymentconfig "sti-perl" created
    service "sti-perl" created
--> Success
    Build scheduled, use 'oc logs -f bc/sti-perl' to track its progress.
    Run 'oc status' to view your app.

Comment 3 XiuJuan Wang 2017-02-08 05:34:36 UTC
Created attachment 1248547 [details]
new-app log

Comment 4 XiuJuan Wang 2017-02-08 05:35:18 UTC
Created attachment 1248548 [details]
imagestream of perl

Comment 5 XiuJuan Wang 2017-02-08 05:35:47 UTC
Yes, I just cut off the top of the output. No port exposes indeed.

$ oc new-app --image-stream=openshift/perl --code=https://github.com/openshift/sti-perl --context-dir=5.20/test/sample-test-app/  --name=app 
--> Found tag :5.20 in image stream "openshift/perl" for "openshift/perl"

    * The source repository appears to match: perl
    * A source build using source code from https://github.com/openshift/sti-perl will be created
      * The resulting image will be pushed to image stream "app:latest"
      * Use 'start-build' to trigger a new build
    * This image will be deployed in deployment config "app"

--> Creating resources ...
    imagestream "app" created
    buildconfig "app" created
    deploymentconfig "app" created
--> Success
    Build scheduled, use 'oc logs -f bc/app' to track its progress.
    Run 'oc status' to view your app.

Paste the new-app log and imagestream info.

Comment 6 Ben Parees 2017-02-08 14:30:30 UTC
ok i was able to recreate this, it's caused by a path in which there is a "latest" imagestream tag which points to an imagestreamtag that was not successfully imported (in your case, latest points to 5.24, and 5.24 does not exist in your registry).  Investigating.

Comment 7 Ben Parees 2017-02-08 22:19:20 UTC
fix is here:
https://github.com/openshift/origin/pull/12878

but to be clear, the wrong behavior here is that we should have errored out telling you that perl:5.20 was a partial match for the requested imagestream openshift/perl and that you need to specify openshift/perl:5.20 explicitly.

The reason for this is that your "latest" imagestreamtag points to "5.24" but "5.24" failed to import (appears not to exist in your registry).  When you do not specify a tag explicitly (as in "openshift/perl"), the searcher defaults to searching for the "latest" tag and only a tag named "latest" or the tag pointed to by "latest" will be considered an exact match.  Anything else will be treated as a partial match (with this fix).

Comment 8 Troy Dawson 2017-02-10 22:46:33 UTC
This has been merged into ocp and is in OCP v3.5.0.19 or newer.

Comment 10 XiuJuan Wang 2017-02-13 05:40:55 UTC
Test in 
Server https://***
openshift v3.5.0.19+199197c
kubernetes v1.5.2+43a9be4


Return partial matches when default latest tag is unavailable.

#oc new-app ruby-ex https://github.com/openshift/ruby-hello-world.git 
error: multiple images or templates matched "ruby-ex": 2

The argument "ruby-ex" could apply to the following Docker images, OpenShift image streams, or templates:

* Image stream "ruby-ex" (tag "2.2") in project "xiuwang1"
  Use --image-stream="xiuwang1/ruby-ex:2.2" to specify this image or template

* Image stream "ruby-ex" (tag "2.0") in project "xiuwang1"
  Use --image-stream="xiuwang1/ruby-ex:2.0" to specify this image or template

Thanks