1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 15:46:57 +01:00
Files
openshift-docs/modules/modifying-template-for-new-projects.adoc
2024-03-15 08:05:54 -04:00

79 lines
2.3 KiB
Plaintext

// Module included in the following assemblies:
//
// * applications/projects/configuring-project-creation.adoc
// * post_installation_configuration/network-configuration.adoc
:_mod-docs-content-type: PROCEDURE
[id="modifying-template-for-new-projects_{context}"]
= Modifying the template for new projects
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:
.Prerequisites
ifndef::openshift-rosa,openshift-dedicated[]
* You have access to an {product-title} cluster using an account with `cluster-admin` permissions.
endif::openshift-rosa,openshift-dedicated[]
ifdef::openshift-rosa,openshift-dedicated[]
* You have access to an {product-title} cluster using an account with `dedicated-admin` permissions.
endif::openshift-rosa,openshift-dedicated[]
.Procedure
. Log in as a user with `cluster-admin` privileges.
. Generate the default project template:
+
[source,terminal]
----
$ oc adm create-bootstrap-project-template -o yaml > template.yaml
----
. Use a text editor to modify the generated `template.yaml` file by adding
objects or modifying existing objects.
. The project template must be created in the `openshift-config` namespace. Load
your modified template:
+
[source,terminal]
----
$ oc create -f template.yaml -n openshift-config
----
. Edit the project configuration resource using the web console or CLI.
** Using the web console:
... 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:
... Edit the `project.config.openshift.io/cluster` resource:
+
[source,terminal]
----
$ oc edit project.config.openshift.io/cluster
----
. Update the `spec` section to include the `projectRequestTemplate` and `name`
parameters, and set the name of your uploaded project template. The default name
is `project-request`.
+
.Project configuration resource with custom project template
[source,yaml]
----
apiVersion: 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.