• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. User Guide 2.0
  4. Container Orchestration
  5. Preparing a Template Package

Preparing a Template Package

Two methods are available to prepare a template package:

Template Package Specifications

The following uses the Redis application as an example. Prepare the Redis application template package according to the template package specifications.

  • Naming Requirement

    A template package is named in the format of application name-major version number.minor version number.revision number.tgz, for example, redis-0.4.2.tgz.

    NOTE:
    • The main version number, minor version number, and revision number must be integers. They must be ≥ 0 and ≤ 99.
    • The main version number and minor version number are mandatory, and the revision number is optional.
  • Directory Structure

    The directory structure of a template package is as follows:

    redis/
      templates/
      values.yaml
      README.md
      Chart.yaml
      .helmignore
    Table 1 lists the parameters of the directory structure of a template package. The parameters marked with an asterisk (*) are mandatory.
    Table 1 Parameters of the directory structure of a template package

    Parameter

    Description

    *templates

    All templates

    *values.yaml

    Configuration parameters essential to describe the template

    README.md

    Markdown file that contains the following:

    • Applications or services provided by Chart.
    • Prerequisites for running Chart.
    • Configurations in the values.yaml file.
    • Information about Chart installation and configuration.

    *Chart.yaml

    Basic information about the template.

    .helmignore

    Files or data that does not need to read templates during application installation.

Customizing a Template Package

  1. Customize the content of a template package as required.

    For details about how to create a template package, see https://github.com/kubernetes/helm/blob/master/docs/charts.md.

  2. Set the template package directory structure and name the template package based on the requirements defined in Template Package Specifications.

Using a Kubernetes Official Template Package

  1. Access https://github.com/kubernetes/charts to obtain the required community template package.
  2. Check whether the package meets Template Package Specifications.
  3. Log in to a Linux machine.
  4. Upload the template package obtained in 1.
  5. Run the following command to compress the template package.

    • If the Helm client is not installed on the Linux machine, run the following command:

      tar pzcf {name}-{version}.tgz {name}/

      In the preceding command,

      {name} indicates the actual name of the template package.

      {version} indicates the actual version of the template package.

    • If the Helm client is installed on the Linux machine, run the following command:

      helm package {name}/

      In the preceding command, {name} indicates the actual name of the template package.

      After package, run the following command to check whether the compressed package is correct.

      helm lint {name}-{version}.tgz

      The compressed package is correct if the following information is displayed:

      ==> Linting {name}-{version}.tgz
      Lint OK