Create a public template

Create a public template (basic procedure)

Perform this task to create a public template for resource orchestration in specific scenario. This example uses Application scenario.

  1. On the top navigation bar, click Cloud Services, and then select Application Orchestration from the App Service menu.

  1. From the left navigation pane, select Public Templates.

  1. Click Create Template.

  1. Configure public template parameters as needed.

Table-1 Configuring template parameters

Parameter

Description

Template Name

Enter the display name of the template on the platform.

When creating a stack, you can select a template by its name.

Version

Set the version of the template.

You can create templates with the same name but different version numbers.

Template Type

Select a type for the template.

A public template is available to all users, and a private template is only available to the creator.

Creation Method

Select a source for the template.

Both JSON file and orchestration designer can be used to create a template.

  • From a JSON file:

  • My Template—Select an existing template and then create a new template based on the selected template. After you select a template, you can view the template data in the Template Content field.

  • Upload File—Select and upload a local file. Then, edit the data of the file in the Template Content field. To use this method, you need to prepare a YAML file ahead.

  • Manually Create—Manually enter the contents in a JSON file to orchestrate a template.

  • By using Orchestration Designer:

  • My Template or Upload File—Select a template or upload a local file, click Use Orchestration Designer to open the template topology and orchestrate the topology as needed.

  • Manually Create—Click Use Orchestration Designer to open the template topology and orchestrate the topology as needed.

 

  1. On the Create Template page, click OK.

Use orchestration designer to edit the template content

The Orchestration Designer page lists available resources in the template.

Table-2 Resources

Resource

Description

Image

Jar

War

Helm

Software package to be deployed.

Container

Cloud Host

Deployment and runtime environment of the software package. Both container and cloud host are supported. Multiple environments can be configured for a software package.

  • Container—Cluster node.

  • Container Permissions—Access permissions of the container to the data of cluster nodes, including network, file systems, and the kernel.

  • Service Access Configuration—Port mappings for outer-cluster access or access within cluster.

  • Cloud Host—Network and VM in the IaaS cloud service.

Container App

Cloud Host App

Associated with a software package. An application is created after the software package is deployed. A software package can be deployed to create multiple applications. Container applications and cloud host applications are created in different deployment environments.

Application Group

Associated with applications. An application group provides a logical isolation space for unified management of applications in the group. An application can be added to different application groups.

Microservices Engines

Associated with an application group. The microservices engine monitors and manages applications in the group. You do not need to orchestrate an Istio microservices engine. It can be created automatically when you create an application group.

 

You can use the orchestration designer to orchestrate the resources and configure the resource parameters as needed to create a complete template topology.

When orchestrating resources in a template, you need to perform the following actions:

To use orchestration designer to orchestrate all necessary resources (including runtime environment, software package, application, application group, and microservices engine) in a template, perform the following steps:

  1. Configure template parameters to be used when configuring resources.

  1. Click the blank space in the topology.

  1. On the Template Attributes window that opens, click Add Parameter. Then, configure the parameter settings as needed.

Table-3 Configuring template parameter settings

Parameter

Description

Parameter Name

Parameter Alias

Enter the display name of the template parameter on the platform.

When configuring a resource, you can select a template parameter by its alias.

Required Parameter

Select whether to set the template parameter as a required parameter.

When deploying a template, you must configure all required parameters in the template.

Parameter Type

Select the type of the template parameter.

Supported types include string, password, lines of texts, number, Boolean value, key value pair, array, table, JSON, and MAP. You can set requirements for different parameter types, such as max character string length, validity rule, and validity prompt.

For a parameter of the string type, you can set its enumeration values in the following mode:

  • Simple mode—Enter the optional values separated by line breaks in the input box. They are displayed as drop-down box options for you to choose during deployment. For example, optional values for the application group name parameter are the names of existing applications groups. When you set the optional values for this parameter, you need to enter the names of existing applications group in the input box.

  • Advanced mode—Match optional values through a JSON file. For example, optional values for the application group name parameter are the names of existing applications groups. When you set the optional values for this parameter, you need to set the match criteria for application groups in the JSON file. Matching application group names are displayed as drop-down box options for you to choose during deployment.

 

The following is an example of configuring the enumerated values for the application name parameter in advanced mode:

// Options with label

selectDemo: {
allowedValues: [
    {
      key: 'option1',
      label: {
        en: 'option1',
        'zh-CN': 'option1',
      },
    },
    {
      key: 'option2',
      label: {
        en: 'option2',
        'zh-CN': 'option2',
      },
    },
    {
      key: 'option3',
      label: {
        en: 'option3',
        'zh-CN': 'option3',
      },
    },
  ],
  default: 'option1',
  label: {
    en: 'select DEMO',
    'zh-CN': 'select DEMO',
  },
  type: 'STRING',
},

// Options without label
selectDemo2: {
  allowedValues: ['OPTION1', 'OPTION2'],
  default: 'OPTION1',
  label: {
    en: 'select DEMO2',
    'zh-CN': 'select DEMO2',
  },
  type: 'STRING',
},

// Obtain options from API
selectDemo3: {
  allowedValues: {
    url: '/cloud/infra/v1.0/zone',
    methods: 'GET',
    async: true,
    header: {
      token: '{system:token}',
    },
    data: {},
    params: {},
    dataType: 'json',
    success: [
      'data',
    ],
    key: 'name',
    label: [
      'name',
    ],
  },
  default: '',
  label: {
    en: 'select DEMO3',
    'zh-CN': 'select DEMO3',
  },
  type: 'STRING',
},

  1. Select a software package.

  1. Select an image, Jar, War, or Helm package, and then drag it to the blank space in the topology.

  1. Double-click the software package, and configure the software package parameters as needed.

Table-4 Configuring software package parameters

Parameter

Description

App Repository

Select Software Package

Select Software Package Version

Select an uploaded software package from the software repository.

Attribute

  • Jar package—Set the JDK version and configure the JVM parameter.

  • War package—Set the Tomcat version and configure the JVM parameter.

  • Helm package—Configure the Helm package settings. When the selected Helm package contains advanced settings, you must configure the parameters based on the keys in the package. For more information about the keys, see the chart.yaml file example of a Helm package in in Application Repository Management.

 

  1. Select a container application or cloud host application.

  1. According to the deployment environment of the software package, select a container application or cloud host application from the available list, drag it to the blank space in the topology, and connect it with the software package.

  1. Double-click the application, and configure application parameters as needed.

To deploy the software package for multiple applications, repeat this step.

Table-5 Configuring application parameters

Parameter

Description

Package

Select a package, which can be connected to the application.

Only the Get configuration method is supported.

Name

Version

Description

Configure the name, version, or description of an application.

Both Input and Get configuration methods are supported.

  • Input—Enter the name or description of an application.

  • Get—Select the template parameter for application name or description. You can configure the application name or description later when deploying the template.

Application Group

Select an application group.

Both Input and Get configuration methods are supported:

  • Input—Select an existing application group in the platform.

  • Get—Select an existing application group in the template. Or, select the template parameter for application group, and select the application group later when deploying the template.

Environment Settings

Container App:

  • Startup CPU Limit, Startup Memory Limit, Operation CPU Limit, and Operation Memory Limit: Set the startup and operation limits of CPU and memory resources for the container. For a type of resources, the startup limit cannot be larger than the operation limit.

  • Startup CPU Limit or Startup Memory Limit—Set the default resource limit for startup. When the container starts up, the size of the resources (CPU or memory) that the system allocates to the container cannot be smaller than the set value.

  • Operation CPU Limit or Operation Memory Limit—Set the default resource limit for operation. When the container is running, the size of the resources (CPU or memory) that the system allocates to the container cannot be larger than the set value.

  • Environmental Variables: Configure the environment variables of the cluster to deploy the software package.

  • Availability Zone: Select an AZ. The AZ provides an isolated runtime environment for the software package. The system will deploy the software package to a node in the AZ.

Both Input and Get configuration methods are supported.

  • Input—Select an existing AZ in the platform.

  • Get—Select the template parameter for AZ, and select the AZ later when deploying the template.

Cloud Host App:

  • VM Settings: Configure the cloud host and port for deploying and running the software package.

  • Cloud Host: You do not need to configure the cloud host in this step. The system automatically recognizes the cloud host in step 4.

  • Port: Configure the port.

Both Input and Get configuration methods are supported.

Input—Select an existing AZ in the platform.

Get—Select an existing template parameter and then select an AZ later when deploying the template.

  • Environmental Variables: Configure the environment variables of the cloud host to deploy the software package.

 

  1. Configure the runtime environment, container or cloud host.

To deploy the software package in runtime environments, repeat this step.

Container:

  1. Select Container Permissions, drag it to the blank space in the topology, and then double-click it.

  1. Configure container permission parameters as needed.

  1. Connect the container permission resource and the container application resource.

Table-6 Configuring container permission parameters

Parameter

Description

Privileged Container

Select whether to run the container in a privileged mode. In this mode, processes in the container run as root.

Host Network

Host PID

Host IPC

Select whether to use the network namespace, PID namespace, or IPC namespace of the host.

Read Only Root Filesystem

Select whether to enable read-only access to the root file system.

Running User UID

Enter the UID of the current user to run the container as the current user.

Linux Capabilities

Select privileges that the Linux kernel supports, execute permission check, for example.

 

  1. Select Service Access Configuration, drag it to the blank space in the topology, and then double-click it.

  1. Configure service access configuration as needed.

  1. Connect the service access configuration resource to the container application resource.

Table-7 Configuring service access configuration

Parameter

Description

Service Access Configuration

Type

Select the type of service access. Supported values include:

  • NodePort—Access within cluster.

  • ClusterIP—Outer-cluster access.

Port Mappings

Select an existing port mapping.

After you select a port mapping, the system will automatically draw a line between the port mapping resource and the service access configuration resource in the topology.

 

Cloud Host:

  1. Select Cloud Host, drag it to the blank space in the topology, and then double-click it.

  1. Configure cloud host parameters as needed.

  1. Connect the cloud host resource and the cloud host application resource.

Table-8 Configuring cloud host parameters

Parameter

Description

Network Type

Subnet

Instance

Password

Select an existing cloud host in the cloud service and the network and subnet to which it belongs. Enter the password of the cloud host.

 

  1. Select an application group.

  1. Select Application Group, drag it to the blank space in the topology, and double-click it.

  1. Configure application group parameters as needed.

  1. Connect the application group resource and the container or cloud host application resource.

To add an application to multiple application groups, repeat this step.

Table-9 Configuring application group parameters

Parameter

Description

Name

Type

Configure the name and type of the application group on the platform.

Both Input and Get configuration methods are supported.

  • Input—Enter the name of the application group and select a microservices engine type for the application group. Supported microservices engine types include Spring Cloud and Istio.

You do not need to orchestrate an Istio microservices engine. It can be created automatically when you create an application group.

  • To configure a Spring Cloud microservices engine, see step 6.

  • Get—Select an existing template parameter, and configure the application group name or type later when deploying the template.

Microservices Engine

Select a microservices engine.

This field is required when the application group type is Spring Cloud or Istio.

Both Input and Get configuration methods are supported.

  • Input—Select an existing microservices engine in the platform.

  • Get—Select an existing microservices engine in the template. Or, select an existing template parameter and select the microservices engine later when deploying the template.

 

  1. Select a microservices engine.

  1. Select Spring Cloud under Microservices Engines, drag it to the blank space in the topology, and connect it to the application group resource.

  1. Double-click it and configure microservices engine parameters as needed.

Table-10 Configuring microservices engine parameters

Parameter

Description

Microservices Engine Name

Description

Configure the display name and description of the microservices engine on the platform.

Both Input and Get configuration methods are supported.

  • Input—Enter the name and description of the microservices engine.

  • Get—Select existing template parameters and configure the microservices engine name and description later when deploying the template.

Availability Zone

Version

Both Input and Get configuration methods are supported.

AZ: Select an AZ. The AZ provides an isolated runtime environment for the software package. The system will deploy the software package to a node in the AZ.

  • InputSelect an existing AZ in the platform for deploying the microservices engine. Select a microservices engine version supported by the platform.

  • GetSelect existing template parameters and configure the AZ or version later when deploying the template.

 

  1. View the orchestrated template topology.

The orchestration of the template topology completes. You can view the template topology and edit it as needed. Resources not configured with required parameters are displayed with a red border.

Figure-1 Topology

 

  1. Click Save in the top right corner of the page to save the topology.

  1. Click Shutdown in the top right corner of the page to close the orchestration designer,

  1. Click OK on the Create Template page.