Bug 1248362

Summary: Users should be able to specify which template/image stream to use when there are templates/image stream with same name in openshift project and user's project.
Product: OKD Reporter: Yanping Zhang <yanpzhan>
Component: ocAssignee: Fabiano Franz <ffranz>
Status: CLOSED CURRENTRELEASE QA Contact: Xingxing Xia <xxia>
Severity: medium Docs Contact:
Priority: low    
Version: 3.xCC: libra-bugs, mmccomas, xxia
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-09 21:51:56 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:

Description Yanping Zhang 2015-07-30 07:36:23 UTC
Description of problem:
When there are templates/image stream with same name in openshift project and user's project, and try to create app using oc new-app with template/image stream. It will use template/image stream in user's project by default, and user can not specify to use template/is in openshift project. 

Version-Release number of selected component (if applicable):
# oc version
oc v1.0.4-14-gc619c36
kubernetes v1.0.0


How reproducible:
Always

Steps to Reproduce:
1.Create templates with same name in openshift project and user's project.
2.Search templates that can be used in user's project.
$oc new-app --search --template=mongodb -n protest
Templates (oc new-app --template=<template>)
-----
mongodb-ephemeral
  Project: protest
  MySQL database service, without persistent storage. WARNING: Any data stored will be lost upon pod destruction. Only use this template for testing
mongodb-ephemeral
  Project: openshift
  MongoDB database service, without persistent storage. WARNING: Any data stored will be lost upon pod destruction. Only use this template for testing
3.Create app from template
# oc new-app --template=mongodb -n protest

Actual results:
3.Using template in user's project:
# oc new-app --template=mongodb -n protest
services/mysql
deploymentconfigs/mysql
Service "mysql" created at 172.30.40.190 with port mappings 3306.
Run 'oc status' to view your app.

Expected results:
3.User should be able to specify to use template in openshift project when use "oc new-app --template"

Additional info:
On web console, if create app in project "protest", user can choose to use templatea/image streams from openshift project or user's project.

Comment 1 Fabiano Franz 2016-07-27 13:07:29 UTC
Fixed in https://github.com/openshift/origin/pull/10026.

Comment 2 Yanping Zhang 2016-07-28 08:42:35 UTC
oc v1.3.0-alpha.2+75fce88
kubernetes v1.3.0+57fb9ac
Tested on devenv-rhel7_4691.
1.Create templates with same name in openshift project and user's project.
2.Search templates that can be used in user's project.
# oc new-app -S --template=rubyTemplates (oc new-app --template=<template>)
-----
ruby-helloworld-sample
  Project: prozyp
  This example shows how to create a simple ruby application in openshift origin v3
ruby-helloworld-sample
  Project: openshift
  This example shows how to create a simple ruby application in openshift origin v3
3.Create app choosing template:
# oc new-app --template=prozyp/ruby-helloworld-sample
--> Deploying template ruby-helloworld-sample for "prozyp/ruby-helloworld-sample"

     ruby-helloworld-sample
     ---------
     This example shows how to create a simple ruby application in openshift origin v3

     * With parameters:
        * ADMIN_USERNAME=admin13R # generated
        * ADMIN_PASSWORD=AioOIreI # generated
        * MYSQL_USER=user1S0 # generated
        * MYSQL_PASSWORD=ddgEQDOG # generated
        * MYSQL_DATABASE=root

--> Creating resources with label app=ruby-sample-build ...
    service "frontend" created
    route "route-edge" created
    imagestream "origin-ruby-sample" created
    imagestream "ruby-22-centos7" created
    buildconfig "ruby-sample-build" created
    deploymentconfig "frontend" created
    service "database" created
    deploymentconfig "database" created
--> Success
    Build scheduled, use 'oc logs -f bc/ruby-sample-build' to track its progress.
    Run 'oc status' to view your app.

Now user could choose template when create app. The bug has been fixed, so move it to Verified.