Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1454535 - modifying project name in template doesn't work [NEEDINFO]
modifying project name in template doesn't work
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Master (Show other bugs)
3.4.1
Unspecified Unspecified
unspecified Severity medium
: ---
: 3.7.0
Assigned To: Michal Fojtik
Wang Haoran
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-05-22 21:06 EDT by Kenjiro Nakayama
Modified: 2017-11-28 16:55 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Creating project using project template does not use the substituted project name, but the namespace name. Consequence: Not able to use parametrized name as a project name as the generated suffix or prefix might be dropped. Fix: Use the substituted project name when creating the namespace. Result:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-11-28 16:55:46 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
knakayam: needinfo? (mfojtik)


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:3188 normal SHIPPED_LIVE Moderate: Red Hat OpenShift Container Platform 3.7 security, bug, and enhancement update 2017-11-28 21:34:54 EST

  None (edit)
Description Kenjiro Nakayama 2017-05-22 21:06:07 EDT
Description of problem:
- We would like to create prefix namespace with requester name.
- The background of this request is that OCP's project/namespace has to be unique. But there are no good way to create the project uniquely atm. 

Version-Release number of selected component (if applicable):
- OCP 3.4

How reproducible:
- 100%

Steps to Reproduce:
1. Modify template like https://docs.openshift.com/container-platform/3.4/admin_guide/managing_projects.html#modifying-the-template-for-new-projects
(e.g)
~~~
  metadata:
    name: ${PROJECT_NAME}-${PROJECT_REQUESTING_USER}
~~~

Actual results:
- Failed to create the project.

  ]$ oc new-project aaa
  Error from server: Internal error occurred: namespaces "aaa" not found

Expected results:
- Create the project with requester name suffix.


Additional info:
- According to Jordan's internal mail, it was possible in previous version(?)

  http://post-office.corp.redhat.com/archives/openshift-sme/2016-September/msg01441.html
(However, as far as I tested on OCP 3.4, it doesn't work).
Comment 1 Michal Fojtik 2017-05-25 06:41:22 EDT
I think there are couple problems here:

1) Using the ${PROJECT_REQUESTING_USER} only for the project name won't work unless you do the same everywhere where ${PROJECT_NAME} parameter is used in the template (iow. RoleBindings, etc.)

2) https://github.com/openshift/origin/pull/14344 this has to be fixed

3) there is a bug in `new-project` that prevents the newly created project to be set.
Comment 2 openshift-github-bot 2017-05-26 22:01:57 EDT
Commit pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/96e068b56c1432cdcdf55895dcd22f37124df0eb
Bug 1454535 - Use created project name over namespace name in project template
Comment 8 ge liu 2017-06-05 03:54:19 EDT
Verified in OCP env:

openshift v3.6.94
kubernetes v1.6.1+5115d708d7
etcd 3.1.0

Steps:
1. login OCP cluster, and working as system:admin user
2. #oadm create-bootstrap-project-template -o yaml > template.yaml
3. Edit template.yaml:

     replace ALL  "name: ${PROJECT_NAME}" to "name: ${PROJECT_NAME}-lg", pay attention all items, but not project metadate name only.

4. modify master-config.yaml: projectRequestTemplate: "default/project-request"  and restart master service

5. # oc new-project ccc --description=lala1
6. # oc get project
NAME               DISPLAY NAME   STATUS
ccc-lg                            Active
Comment 9 wewang 2017-06-05 05:08:46 EDT
verified in 
openshift v3.6.94
kubernetes v1.6.1+5115d708d7
etcd 3.1.0
oc v3.6.94

[root@dhcp-128-91 Downloads]# ./usr/share/atomic-openshift/linux/oc  new-project wewang
Now using project "wewang-wewang" on server "https://host-xxxx:8443".

You can add applications to this project with the 'new-app' command. For example, try:

    oc new-app centos/ruby-22-centos7~https://github.com/openshift/ruby-ex.git

to build a new example application in Ruby.
Comment 19 errata-xmlrpc 2017-11-28 16:55:46 EST
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/RHSA-2017:3188

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