Creating a custom default template for new project.

Solution Verified - Updated -

Environment

  • Redhat Openshift Container Platform (OCP)
    • 3.x
    • 4.x

Resolution

  • The API server automatically provisions projects based on the template that is identified by the projectRequestTemplate parameter of the master-config.yaml file.
  • If the parameter is not defined, the API server creates a default template that creates a project with the requested name, and assigns the requesting user to the "admin" role for that project.

  • To create your own custom project template:

1.Start with the current default project template:

$ oc adm create-bootstrap-project-template -o yaml > template.yaml

2.Use a text editor to modify the template.yaml file by adding objects or modifying existing objects.

3.Load the template:

$ oc create -f template.yaml -n default

4.Modify the master-config.yaml file to reference the loaded template:

...
projectConfig:
  projectRequestTemplate: "default/project-request"
  ...

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments