diff --git a/dev_guide/console.adoc b/dev_guide/console.adoc index b24014ee60ee..97393041992c 100644 --- a/dev_guide/console.adoc +++ b/dev_guide/console.adoc @@ -69,34 +69,3 @@ image:console_filter_step3.png["Console Filter Step 3"] image:console_filter_active.png["Console Filter Active"] ==== - - -== Creating from Template - -A link:templates.html[template] describes a set of resources that can be created together. To create an instance from a template using the Management Console: - -1. Click on the *Create* button: -+ -==== - -image:console_create.png["Console Create"] -==== - -2. Select a template from the list of templates in your project, or provided by OpenShift: -+ -==== - -image:console_select_template.png["Select Template"] -==== - -3. Modify template parameters. Labels and parameters can be modified in the template creation screen: -+ -==== - -image:create_from_template.png["Create from Template"] -==== -+ -<1> Template name and description. -<2> Container images included in the template. -<3> Labels to assign to all items included in the template. You can add and edit labels for resources. -<4> Parameters defined by the template. You can edit values for parameters defined in the template here. diff --git a/dev_guide/templates.adoc b/dev_guide/templates.adoc index 971bab483e50..8514fb11d55a 100644 --- a/dev_guide/templates.adoc +++ b/dev_guide/templates.adoc @@ -10,7 +10,7 @@ toc::[] == Overview -A template describes a set of resources intended to be used together that can be customized and processed to produce a configuration. Each template defines a list of parameters that can be modified for consumption by containers. It also defines a set of labels to apply to every resource created by the template. +A template describes a set of resources intended to be used together that can be customized and processed to produce a configuration. Each template defines a set of parameters that can be modified for consumption by containers, and defines a set of labels to apply to every resource created by the template. .Sample Template JSON File: ==== @@ -51,13 +51,81 @@ A template describes a set of resources intended to be used together that can be ==== -== Creating a Project From a Template +== Creating a Configuration From a Template -You can create a project from a template that has been uploaded to your OpenShift instance. After a template has been uploaded, you can create a new project from either the Management Console or the CLI. +You can create a configuration from a template with either the Management Console or the CLI, after first uploading a template to your OpenShift instance. -On the Management Console, click on the Create button on the project page. It will then ask you to choose the template to create from, or upload a new template. +Create a template json file, like the above example, then upload it with the the CLI using the following process: -On the CLI, you can create a template json file, then upload it with the process outlined in the link:../cli_reference/basic_cli_operations.adoc[Project Operations] section. +=== Uploading a Template +Load a json template file into the OpenShift template library with the following command: + +**** +`osc create -f __` +**** + +The template is now available to be selected for a configuration using the Management Console or the CLI. + +=== Generating a Configuration +When OpenShift processes a template, it creates a configuration. You can override the parameters with the values defined in the configuration file by adding the appropriate flags. + +Generate a configuration with the following command: + +**** +`osc process -f __` +**** + +You can override the *`ADMIN_USERNAME`* and *`MYSQL_DATABASE`* link:../dev_guide/templates.html#Parameters[parameters] to create a JSON string to apply to the server. The JSON string represents a configuration with customized environment variables: + +.Generating a Configuration +==== + +---- +$ osc process -f examples/sample-app/application-template-dockerbuild.json -v ADMIN_USERNAME=root,MYSQL_DATABASE=admin +---- + +==== + +The JSON string can either be redirected to a file or applied directly by piping the process output to the `create` command: + +.Redirecting JSON String +==== + +---- +$ osc process -f examples/sample-app/application-template-dockerbuild.json -v ADMIN_USERNAME=root,MYSQL_DATABASE=admin | osc create -f - +---- + +==== + +=== Creating from Template + +To create an configuration from a template using the Management Console: + +1. Click on the *Create+* button: ++ +==== + +image:console_create.png["Console Create"] +==== + +2. Select a template from the list of templates in your project, or provided by OpenShift: ++ +==== + +image:console_select_template.png["Select Template"] +==== + +3. Modify template parameters in the template creation screen: ++ +==== + +image:create_from_template.png["Create from Template"] +==== ++ +<1> Template name and description. +<2> Container images included in the template. +<3> Labels to assign to all items included in the template. You can add and edit labels for resources. +<4> Parameters defined by the template. You can edit values for parameters defined in the template here. == Labels link:../architecture/core_objects/kubernetes_model.html#label[Labels] are used to manage and organize generated resources, such as pods. The labels specified in the template are applied to every resource that is generated from the template. @@ -92,34 +160,3 @@ MYSQL_DATABASE database name root ==== The output identifies several parameters that are generated with a regex expression generator when the template is processed. - -== Generating a Configuration -When OpenShift processes a template, it creates a configuration. You can override the parameters with the values defined in the configuration file by adding the appropriate flags. - -Generate a configuration with the following command: - -**** -`osc process -f __` -**** - -Continuing with the previous example, you can override the *`ADMIN_USERNAME`* and *`MYSQL_DATABASE`* environment variables to create a JSON string to apply to the server. The JSON string represents a configuration with customized environment variables, as shown in the following example. - -.Generating a Configuration -==== - ----- -$ osc process -f examples/sample-app/application-template-dockerbuild.json -v ADMIN_USERNAME=root,MYSQL_DATABASE=admin ----- - -==== - -The JSON string can either be redirected to a file or applied directly by piping the process output to the `apply` command, as shown in the following example. - -.Redirecting JSON String -==== - ----- -$ osc process -f examples/sample-app/application-template-dockerbuild.json -v ADMIN_USERNAME=root,MYSQL_DATABASE=admin | osc apply -f - ----- - -====