Bug 1375146

Summary: Pods don't have labels added from 'create from template' page
Product: OpenShift Container Platform Reporter: Xingxing Xia <xxia>
Component: Management ConsoleAssignee: Jessica Forrester <jforrest>
Status: CLOSED DUPLICATE QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.3.0CC: aos-bugs, bparees, jokerman, mmccomas
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-22 15:39:45 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 Xingxing Xia 2016-09-12 09:47:34 UTC
Description of problem:
Pods don't have labels added from 'create from template' page. Other resources such as dc/rc/bc/is etc have, though.
But CLI `oc new-app <template_name> -l <Label_key_val_pairs>` can let pods have the labels.

Version-Release number of selected component (if applicable):
v3.3.0.30

How reproducible:
Always

Steps to Reproduce:
1. Login to openshift, create project
2. Prepare template:
$ oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/application-template-stibuild.json
3. On web console, click "Add to project" --> select "ruby-helloworld-sample". In "Labels" section, click "Add label" to add labels, such as pairs: test=1234, test1=abcd
4. Check labels of database/frontend pods

Actual results:
4. database/frontend pods don't have the labels added from web console.

Expected results:
4. database/frontend pods should have the labels added from web console, as `oc new-app <template_name> -l <Label_key_val_pairs>` does.

Additional info:

Comment 1 Jessica Forrester 2016-09-12 13:24:09 UTC
The console has always behaved this way, the CLI behavior has been changing and there is still some debate over the current state. See a related CLI issue https://github.com/openshift/origin/issues/9314

and issues around the app label specifically:
https://github.com/openshift/origin/pull/10789
https://github.com/openshift/origin/issues/10782

Should wait for the CLI discussions to be settled on what the right solution is and then we will fix the console to match.

Comment 2 Ben Parees 2016-09-22 14:22:22 UTC
new-app behaves differently because that label logic is not part of template processing, it is part of the new-app behavior which says "add the labels provided by the user, to all the objects produced by whatever new-app is doing."  In this case, new-app processed the template, got back a list of objects, and then added the requested labels.

When adding labels to objects, new-app uses a helper method which drills down into deploymentconfigs and also adds the label to the pod template defined within the DC.

That is separate logic from the template processing logic which says "take the labels defined on the template and apply them to all top level Objects defined in the template", which is what the web console and oc process use when adding user provided labels during template instantiation.

Comment 3 Ben Parees 2016-09-22 15:39:45 UTC

*** This bug has been marked as a duplicate of bug 1314619 ***