Bug 1371851

Summary: "oc new-app" failed resolve template when the template name defined using template parameter
Product: OpenShift Container Platform Reporter: Dongbo Yan <dyan>
Component: BuildAssignee: Cesar Wong <cewong>
Status: CLOSED WONTFIX QA Contact: Wang Haoran <haowang>
Severity: low Docs Contact:
Priority: low    
Version: 3.3.0CC: aos-bugs, bparees
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: 2016-09-08 18:13:17 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 Dongbo Yan 2016-08-31 09:25:09 UTC
Description of problem:
"oc new-app" failed resolve template when the template name defined using template parameter.

Version-Release number of selected component (if applicable):
openshift v3.3.0.27
kubernetes v1.3.0+507d3a7
etcd 2.3.0+git

How reproducible:
Always

Steps to Reproduce:
1.Create a project, create an application
 $ oc new-app https://raw.githubusercontent.com/openshift-qe/v3-testfiles/4049744e9f2d37229a1aeaade3fc7f1dfc5c66ef/templates/tc479059/application-template-parameters.json
2.
3.

Actual results:
--> Deploying template ${TEMPLATE_NAME} for "https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/templates/tc479059/application-template-parameters.json"

${TEMPLATE_NAME}
---------
This example shows how to create a simple ruby application in openshift origin v3

* With parameters:
* ADMIN_USERNAME=adminKN8 # generated
* ADMIN_PASSWORD=IToCjjlR # generated
* MYSQL_USER=userO7L # generated
* MYSQL_PASSWORD=bG6vybvq # generated
* MYSQL_DATABASE=root
* GIT_URI=git://github.com/openshift/ruby-hello-world.git
* KIND_BC=BuildConfig
* IMAGESTREAM_SPEC_REPO=openshift/ruby-20-centos7
* TEMPLATE_NAME=ruby-helloworld-sample

--> Creating resources with label ...
error: ImageStream "origin-ruby-sample" is invalid: metadata.labels: Invalid value: "${TEMPLATE_NAME}": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345')
error: ImageStream "ruby-22-centos7" is invalid: metadata.labels: Invalid value: "${TEMPLATE_NAME}": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345')
error: BuildConfig "ruby-sample-build" is invalid: metadata.labels: Invalid value: "${TEMPLATE_NAME}": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345')
error: DeploymentConfig "frontend" is invalid: [metadata.labels: Invalid value: "${TEMPLATE_NAME}": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345'), spec.template.labels: Invalid value: "${TEMPLATE_NAME}": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345')]
--> Failed 

Expected results:
Create application successfully

Additional info:
If use $ oc process -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/4049744e9f2d37229a1aeaade3fc7f1dfc5c66ef/templates/tc479059/application-template-parameters.json | oc create -f -
will create application successfully

Comment 1 Ben Parees 2016-09-08 18:13:17 UTC
template name isn't a substitutable field and i can't think of a good use case for making it one.  the template message is substitutable and should be able to fill any need.

furthermore it's confusing to have a template registered with one name, but then pick up a different name on substitution.