Modifying the template for new projects
To modify the default project template to customize the resources and settings applied when users create new projects, you can create a custom project template.
As a cluster administrator, you can modify the default project template so that new projects are created using your custom requirements.
To create your own custom project template:
-
You have access to an Red Hat OpenShift Container Platform cluster using an account with
cluster-adminpermissions.
-
Log in as a user with
cluster-adminprivileges. -
Generate the default project template:
$ oc adm create-bootstrap-project-template -o yaml > template.yaml -
Use a text editor to modify the generated
template.yamlfile by adding objects or modifying existing objects. -
The project template must be created in the
openshift-confignamespace. Load your modified template:$ oc create -f template.yaml -n openshift-config -
Edit the project configuration resource using the web console or CLI.
-
Using the web console, complete the following tasks:
-
Navigate to the Administration → Cluster Settings page.
-
Click Configuration to view all configuration resources.
-
Find the entry for Project and click Edit YAML.
-
-
Using the CLI, complete the following tasks:
-
Edit the
project.config.openshift.io/clusterresource:$ oc edit project.config.openshift.io/cluster
-
-
-
Update the
specsection to include theprojectRequestTemplateandnameparameters. Ensure you set the name of your uploaded project template. The default name isproject-request.Project configuration resource with custom project templateapiVersion: config.openshift.io/v1 kind: Project metadata: # ... spec: projectRequestTemplate: name: <template_name> # ... -
After you save your changes, create a new project to verify that your changes were successfully applied.