Helm Specifications translated. (#976)

* Helm Specifications translated.

Signed-off-by: Felixnoo <felixliu@yunify.com>

* Update helm-specification.md

Co-authored-by: Sherlock113 <65327072+Sherlock113@users.noreply.github.com>
This commit is contained in:
Felixnoo 2021-01-20 10:18:44 +08:00 committed by GitHub
parent 027508d696
commit 0a34baecc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 63 additions and 62 deletions

View File

@ -107,7 +107,7 @@ spec:
value: {{default "minio" .Values.storage}}
```
The above example defines a ReplicationController template in Kubernetes. There some values referenced in it which are defined in `values.yaml`.
The above example defines a ReplicationController template in Kubernetes. There are some values referenced in it which are defined in `values.yaml`.
- `imageRegistry`: The Docker image registry.
- `dockerTag`: The Docker image tag.

View File

@ -1,82 +1,82 @@
---
title: "Helm Specifications"
keywords: 'Kubernetes, KubeSphere, Helm, specifications'
description: 'Helm Specifications'
linkTitle: "Helm Specifications"
title: "Helm 规范"
keywords: 'Kubernetes, KubeSphere, Helm, 规范'
description: 'Helm 规范'
linkTitle: "Helm 规范"
weight: 14420
---
Helm charts serve as a packaging format. A chart is a collection of files that describe a related set of Kubernetes resources. For more information, see the [Helm documentation](https://helm.sh/docs/topics/charts/).
Helm Chart 是一种打包格式。Chart 是一个描述一组 Kubernetes 相关资源的文件集合。有关更多信息,请参见 [Helm 文档](https://helm.sh/zh/docs/topics/charts/)。
## Structure
## 结构
All related files of a chart is stored in a directory which generally contains:
Chart 的所有相关文件都存储在一个目录中,该目录通常包含:
```text
chartname/
Chart.yaml # A YAML file containing basic information about the chart, such as version and name.
LICENSE # (Optional) A plain text file containing the license for the chart.
README.md # (Optional) The description of the app and how-to guide.
values.yaml # The default configuration values for this chart.
values.schema.json # (Optional) A JSON Schema for imposing a structure on the values.yaml file.
charts/ # A directory containing any charts upon which this chart depends.
crds/ # Custom Resource Definitions.
templates/ # A directory of templates that will generate valid Kubernetes configuration files with corresponding values provided.
templates/NOTES.txt # (Optional) A plain text file with usage notes.
Chart.yaml # 包含 Chart 基本信息(例如版本和名称)的 YAML 文件。
LICENSE # (可选)包含 Chart 许可证的纯文本文件。
README.md # (可选)应用说明和使用指南。
values.yaml # 该 Chart 的默认配置值。
values.schema.json # (可选)向 values.yaml 文件添加结构的 JSON Schema。
charts/ # 一个目录,包含该 Chart 所依赖的任意 Chart。
crds/ # 自定义资源定义。
templates/ # 模板的目录,若提供相应值便可以生成有效的 Kubernetes 配置文件。
templates/NOTES.txt # (可选)包含使用说明的纯文本文件。
```
## Chart.yaml File
## Chart.yaml 文件
You must provide the `chart.yaml` file for a chart. Here is an example of the file with explanations for each field.
您必须为 Chart 提供 `chart.yaml` 文件。下面是一个示例文件,每个字段都有说明。
```yaml
apiVersion: (Required) The chart API version.
name: (Required) The name of the chart.
version: (Required) The version, following the SemVer 2 standard.
kubeVersion: (Optional) The compatible Kubernetes version, following the SemVer 2 standard.
description: (Optional) A single-sentence description of the app.
type: (Optional) The type of the chart.
apiVersion: 必需Chart API 版本。
name: 必需Chart 名称。
version: (必需)版本,遵循 SemVer 2 标准。
kubeVersion: (可选)兼容的 Kubernetes 版本,遵循 SemVer 2 标准。
description: (可选)对应用的一句话说明。
type: 可选Chart 的类型。
keywords:
- (Optional) A list of keywords about the app.
home: (Optional) The URL of the app.
- (可选)关于应用的关键字列表。
home: (可选)应用的 URL。
sources:
- (Optional) A list of URLs to source code for this app.
dependencies: (Optional) A list of the chart requirements.
- name: The name of the chart, such as nginx.
version: The version of the chart, such as "1.2.3".
repository: The repository URL ("https://example.com/charts") or alias ("@repo-name").
condition: (Optional) A yaml path that resolves to a boolean, used for enabling/disabling charts (e.g. subchart1.enabled ).
tags: (Optional)
- Tags can be used to group charts for enabling/disabling together.
import-values: (Optional)
- ImportValues holds the mapping of source values to parent key to be imported. Each item can be a string or pair of child/parent sublist items.
alias: (Optional) Alias to be used for the chart. It is useful when you have to add the same chart multiple times.
maintainers: (Optional)
- name: (Required) The maintainer name.
email: (Optional) The maintainer email.
url: (Optional) A URL for the maintainer.
icon: (Optional) A URL to an SVG or PNG image to be used as an icon.
appVersion: (Optional) The app version. This needn't be SemVer.
deprecated: (Optional, boolean) Whether this chart is deprecated.
- (可选)应用源代码的 URL 列表。
dependencies: 可选Chart 必要条件的列表。
- name: Chart 的名称,例如 nginx。
version: Chart 的版本,例如 "1.2.3"。
repository: 仓库 URL ("https://example.com/charts") 或别名 ("@repo-name")。
condition: (可选)解析为布尔值的 YAML 路径,用于启用/禁用 Chart (例如 subchart1.enabled
tags: (可选)
- 用于将 Chart 分组,一同启用/禁用。
import-values: (可选)
- ImportValues 保存源值到待导入父键的映射。每一项可以是字符串或者一对子/父子列表项。
alias: 可选Chart 要使用的别名。当您要多次添加同一个 Chart 时,它会很有用。
maintainers: (可选)
- name: (必需)维护者姓名。
email: (可选)维护者电子邮件。
url: (可选)维护者 URL。
icon: (可选)要用作图标的 SVG 或 PNG 图片的 URL。
appVersion: (可选)应用版本。不需要是 SemVer。
deprecated: (可选,布尔值)该 Chart 是否已被弃用。
annotations:
example: (Optional) A list of annotations keyed by name.
example: (可选)按名称输入的注解列表。
```
{{< notice note >}}
- The field `dependencies` is used to define chart dependencies which were located in a separate file `requirements.yaml` for `v1` charts. For more information, see [Chart Dependencies](https://helm.sh/docs/topics/charts/#chart-dependencies).
- The field `type` is used to define the type of chart. Allowed values are `application` and `library`. For more information, see [Chart Types](https://helm.sh/docs/topics/charts/#chart-types).
- `dependencies` 字段用于定义 Chart 依赖项,`v1` Chart 的依赖项都位于单独文件 `requirements.yaml` 中。有关更多信息,请参见 [Chart 依赖项](https://helm.sh/zh/docs/topics/charts/#chart-dependency)。
- `type` 字段用于定义 Chart 的类型。允许的值有 `application``library`。有关更多信息,请参见 [Chart 类型](https://helm.sh/zh/docs/topics/charts/#chart-types)。
{{</ notice >}}
## Values.yaml and Templates
## Values.yaml 和模板
Written in the [Go template language](https://golang.org/pkg/text/template/), Helm chart templates are stored in the `templates` folder of a chart. There are two ways to provide values for the templates:
Helm Chart 模板采用 [Go 模板语言](https://golang.org/pkg/text/template/)编写并存储在 Chart 的 `templates` 文件夹。有两种方式可以为模板提供值:
1. Make a `values.yaml` file inside of a chart with default values that can be referenced.
2. Make a YAML file that contains necessary values and use the file through the command line with `helm install`.
1. 在 Chart 中创建一个包含可供引用的默认值的 `values.yaml` 文件。
2. 创建一个包含必要值的 YAML 文件,通过在命令行使用 `helm install` 命令来使用该文件。
Here is an example of the template in the `templates` folder.
下面是 `templates` 文件夹中模板的示例。
```yaml
apiVersion: v1
@ -107,14 +107,14 @@ spec:
value: {{default "minio" .Values.storage}}
```
The above example defines a ReplicationController template in Kubernetes. There some values referenced in it which are defined in `values.yaml`.
上述示例在 Kubernetes 中定义 ReplicationController 模板,其中引用的一些值已在 `values.yaml` 文件中进行定义。
- `imageRegistry`: The Docker image registry.
- `dockerTag`: The Docker image tag.
- `pullPolicy`: The image pulling policy.
- `storage`: The storage backend. It defaults to `minio`.
- `imageRegistry`Docker 镜像仓库。
- `dockerTag`Docker 镜像标签 (tag)。
- `pullPolicy`:镜像拉取策略。
- `storage`:存储后端,默认为 `minio`
An example `values.yaml` file:
下面是 `values.yaml` 文件的示例:
```text
imageRegistry: "quay.io/deis"
@ -123,8 +123,9 @@ pullPolicy: "Always"
storage: "s3"
```
## Reference
## 参考
[Helm Documentation](https://helm.sh/docs/)
[Helm 文档](https://helm.sh/zh/docs/)
[Chart](https://helm.sh/zh/docs/topics/charts/)
[Charts](https://helm.sh/docs/topics/charts/)