Skip to content

Commit 2f20671

Browse files
authored
Merge pull request #154 from vgjm/dev
feat: translate config-deployment-syntax.md
2 parents 97cd87f + 8e91a1c commit 2f20671

File tree

3 files changed

+119
-85
lines changed

3 files changed

+119
-85
lines changed

docs/config/config-deployment-advance.md

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,29 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
1212

1313
******
1414

15-
# Dep 组件与其他配置方式的支持
15+
# Support for Dep components and other configuration methods
1616

17-
Nocalhost 的开发配置支持多种开发方式,如 ConfigMapAnnotations 等。实际上,这些配置方式**同样适用于**部署配置。但有些功能是需要配合 K8s WebHook 功能来实现,在 Nocalhost 中,是由一个叫做 `Nocalhost-Dep` 的组件来承担这个角色,`Nocalhost Server` 将自动为你部署这个组件,如果你没有使用 `Nocalhost Server`,那么则需要额外进行 `Nocalhost Dep` 的部署。
17+
Nocalhost's development configuration supports multiple developing ways, such as ConfigMap, Annotations, etc. In fact, these configuration methods ** also suit for ** deployment configuration. But some functions need to be implemented through the K8s adminssion WebHook. In Nocalhost, a component called `Nocalhost-Dep` plays this role, and `Nocalhost Server` will automatically deploy this component for you. if you do not use `Nocalhost Server`, then additional deployment of `Nocalhost Dep` is required.
1818

1919
<br/>
2020

2121
:::info
2222

23-
[Nocalhost 提供了哪些部署配置?](config-deployment-spec.md) 中介绍了哪些部署配置需要额外部署 `Nocalhost Dep` 来进行支持。
23+
[What deployment configurations does Nocalhost provide?](config-deployment-spec.md) introduces which deployment configurations require additional deployment of `Nocalhost Dep`.
2424

2525
:::
2626

2727
<br/>
2828

2929
******
3030

31-
## 使用 ConfigMap 配置部署配置
31+
## Using ConfigMap to make deployment configuration
3232

33-
[部署配置入门 ——— Nocalhost 基础部署配置](config-deployment-quickstart.md) 提到了如何配置一个简单的部署配置。结合 [Nocalhost 支持哪些配置方式 —— 将配置放置在 configmap](configure-en.md#将配置放置在-configmap-中),我们可以得到 ConfigMap 部署配置:
33+
To make a simple deployment configuration is mentioned in [Introduction to Deployment Configuration --- Nocalhost Basic Deployment Configuration](config-deployment-quickstart.md). Combining with [What configuration methods are supported by Nocalhost-place the configuration in configmap](configure-en.md#configuration-in-configmap), we can get the configuration:
3434

35-
我们为此准备了一个体验项目,它将自动部署 `Nocalhost Dep`,并且使用 ConfigMap 的形式进行部署配置的配置。
35+
We have prepared an demo for this, which will automatically deploy `Nocalhost Dep`, and use the way of ConfigMap to make the deployment configuration.
3636

37-
38-
:::tip 使用下列命令来获取并查看此项目(体验该 Chart 包需要 ClusterAdmin 级别的权限)
37+
:::tip Using the following commands to try out this demo (trying the Chart package requires ClusterAdmin)
3938

4039
```shell
4140
git clone https://github.com/nocalhost/bookinfo && git checkout config/example
@@ -45,17 +44,15 @@ git clone https://github.com/nocalhost/bookinfo && git checkout config/example
4544

4645
<br/>
4746

48-
49-
然后再使用 Helm 来进行安装:
47+
Then use Helm to install:
5048

5149
```shell
5250
helm dep build ./charts/bookinfo && helm install bookinfo ./charts/bookinfo
5351
```
5452

5553
<br/>
5654

57-
58-
部署配置的内容本身这里不做赘述,我们来看看 `charts/bookinfo/templates/nocalhost-app-config.yaml`
55+
The content of the deployment configuration itself will not be repeated here. let's take a look at `charts/bookinfo/templates/nocalhost-app-config.yaml`.
5956

6057
```yaml
6158
apiVersion: v1
@@ -77,7 +74,7 @@ data:
7774
7875
:::danger
7976
80-
这个 ConfigMap 需要最先被提交的 Api Server,如在 Helm 的应用场景下,它应该被声明为 `pre-install`
77+
This ConfigMap requires to apply to Api Server first. For example, in the Helm application scenario, it should be declared as `pre-install`.
8178

8279
```yaml
8380
annotations:
@@ -88,7 +85,7 @@ data:
8885

8986
<br/>
9087

91-
它引入了 `.Values.nocalhost.config.path` 来渲染部署配置的主体内容。配置实际上声明在 `./charts/bookinfo/example/config-from-cm/nocalhost-full-config.yaml` 中,它是一个标准的 Nocalhost 部署配置,没有做额外的改造:
88+
It introduces `.Values.nocalhost.config.path` to render the main body of the deployment configuration. The configuration is actually declared in `./charts/bookinfo/example/config-from-cm/nocalhost-full-config.yaml`, which is a standard Nocalhost deployment configuration without any additional modification:
9289

9390
```yaml
9491
application:
@@ -154,21 +151,21 @@ application:
154151

155152
******
156153

157-
## 使用 Annotations 配置部署配置
154+
## Using Annotations to make the deployment configuration
158155

159-
使用方式与 [Nocalhost 支持哪些配置方式 —— 将配置放置在 annotations 中](configure-en.md#将配置放置在-annotations-中) 完全一致。
156+
The method of usage is exactly the same as [Which configuration methods Nocalhost supports-place the configuration in annotations](configure-en.md#configuration-in-annotations).
160157

161-
:::danger 额外注意
158+
:::danger Extra attention
162159

163-
由于 Annotations 紧跟工作负载,所以不支持应用级别的一些配置,仅支持 `application.services` 下的配置。
160+
Since Annotations closely follow the workload, some configurations at the application level are not supported. Only the configurations under `application.services` is supported.
164161

165162
:::
166163

167164
<br/>
168165

169-
同样使用上述这个体验项目:
166+
Again, use the same demo project:
170167

171-
:::tip 使用下列命令来获取并查看此项目(体验该 Chart 包需要 ClusterAdmin 级别的权限)
168+
:::tip Use the following commands to get and try out this project (trying the Chart package requires ClusterAdmin)
172169

173170
```shell
174171
git clone https://github.com/nocalhost/bookinfo && git checkout config/example
@@ -179,15 +176,15 @@ git clone https://github.com/nocalhost/bookinfo && git checkout config/example
179176
<br/>
180177

181178

182-
然后再使用 Helm 来进行安装:
179+
Then use Helm to install:
183180

184181
```shell
185182
helm dep build ./charts/bookinfo && helm install bookinfo ./charts/bookinfo -f ./charts/bookinfo/values-annotation-config.yaml
186183
```
187184

188185
<br/>
189186

190-
我们指定了 `values-annotation-config.yaml` 作为 Values.yaml,里面指定了将本地配置文件渲染到工作负载的 Annotations 中,以 `./charts/bookinfo/templates/microservice-details.yaml` 为例:
187+
We specified `values-annotation-config.yaml` as Values.yaml, which specifies the rendering of the local configuration file to the Annotations of the workload. Take `./charts/bookinfo/templates/microservice-details.yaml` as an example:
191188

192189
```yaml
193190
apiVersion: apps/v1
@@ -205,7 +202,7 @@ metadata:
205202

206203
<br/>
207204

208-
Helm 会将 `.Values.nocalhost.annotations.path.details` 所配置路径渲染到 yaml 中,内容如下,即 Values 中指定的 `./charts/bookinfo/example/config-from-annotations/details.yaml`
205+
Helm will render the path configured by `.Values.nocalhost.annotations.path.details` into yaml, whose content is as follows, that is, `./charts/bookinfo/example/config-from-annotations/details.yaml` specified in Values :
209206

210207
```yaml
211208
containers:
@@ -219,12 +216,12 @@ containers:
219216

220217
******
221218

222-
## 如何部署 `Nocalhost Dep`
219+
## How to deploy `Nocalhost Dep`
223220

224-
我们推荐使用 `Nocalhost Server` 来获得 `Nocalhost Dep` 的全部功能。
221+
We recommend using `Nocalhost Server` to get all the functions of `Nocalhost Dep`.
225222

226223
:::danger
227224

228225
COMING SOON
229226

230-
:::
227+
:::

docs/config/config-deployment-spec.md

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
1414

1515
******
1616

17-
# Nocalhost 提供了哪些部署配置?
17+
# What deployment configurations does Nocalhost provide?
1818

19-
:::danger 部分配置需额外组件
19+
:::danger Some configurations require additional components
2020

2121

22-
部署配置的部分功能依赖于 **Nocalhost-Dep 组件**,如果你使用 Nocalhost Server,我们会自动帮你处理这个组件的安装,否则需要进行额外的安装。
22+
Some functions of the deployment configuration rely on the **Nocalhost-Dep component**. If you use Nocalhost Server, we will automatically install this component for you. Otherwise an additional installation is required.
2323

24-
如果没有安装 **Nocalhost-Dep 组件**,部分功能将受限,文章中将会标记出那些需要借助 ** Nocalhost-Dep ** 才能实现的功能。
24+
If the **Nocalhost-Dep component** is not installed, some functions will be restricted. This article will mark those functions that need **Nocalhost-Dep**.
2525

2626
:::
2727

28-
## 启动顺序依赖控制 ([组件依赖](#danger))
29-
范例:
28+
## Startup dependency control ([component dependency](#danger))
29+
Example:
3030
```yaml
3131
application:
3232
name: example
@@ -45,18 +45,20 @@ application:
4545
- "job-name=init-job"
4646
```
4747
48-
当某项资源在部署配置中声明了 `dependLabelSelector` 以后, `pods` 数组中的字符代表要等待的 pods 的 labels,格式为键值对。`jobs` 数组中的字符代表要等待的 jods 的 labels,格式为键值对。
48+
When a resource declares `dependLabelSelector` in the deployment configuration, the characters in the `pods` array represent the labels of the pods to be waited for. The format is key-value pairs. The characters in the `jobs` array represent the labels of the jods to be waited for. The format is also key-value pairs.
4949

50-
`pods` `jobs` 都为可选项。实际部署过程中,它会为指定的工作负载生成一个 `initContinaer`,等待所有匹配 label 的 pods 状态为 `Ready`,等待所有匹配 label 的 jobs 状态为 `Succeeded`
50+
Both `pods` and `jobs` are optional. When you actually deploy your application, it will generate an `initContainer` for the specified workload, wait for the status of all pods matching the label to be `Ready`, and wait for the status of all jobs matching the label to be `Succeeded`.
5151

5252
<br/>
5353

5454
******
5555

56-
## 环境变量注入 ([组件依赖](#danger))
56+
## Injecting Environment variable ([Component dependency](#danger))
57+
58+
### Injecting Global variable
59+
60+
Example:
5761

58-
### 全局变量注入
59-
范例:
6062
```yaml
6163
application:
6264
name: example
@@ -76,24 +78,33 @@ application:
7678
7779
```
7880

79-
全局变量注入需要声明在 `application` 这一级,在部署时,它将往所有部署的 `Deployment`、`DaemonSet`、`ReplicaSet`、`StatefulSet`、`Job`、`CronJob` 中注入对应的环境变量。
81+
Injecting global variables needs to be declared at the level of `application`. During the deployment, it will inject the corresponding environment variables into all deployed `Deployment`, `DaemonSet`, `ReplicaSet`, `StatefulSet`, `Job`, and `CronJob`.
82+
83+
:::tip Injecting variables supports two kinds syntax, which can be mixed
84+
85+
- The first one is to declare key-value pairs directly
86+
- The second is to declare an env file relative to `config.yaml`, the content is line-by-line `Key=Value`:
87+
8088

81-
:::tip 变量注入支持两种写法,可以混搭
82-
- 第一种是直接声明键值对
83-
- 第二种是声明一个相对于 `config.yaml` 的 env 文件,内容为逐行的 `Key=Value`:
8489
```dotenv
90+
8591
DEBUG=true
8692
DOMAIN=nocalhost.dev
93+
8794
```
95+
8896
:::
8997

90-
其中,`env` 的优先级高于 `envFrom`
98+
The priority of `env` is higher than that of `envFrom`
9199

92100
<br/>
93101

94-
### 容器级变量注入
95-
范例:
102+
### Injecting variables at the level of container
103+
104+
Example:
105+
96106
```yaml
107+
97108
application:
98109
name: example
99110
manifestType: rawManifestGit
@@ -116,16 +127,19 @@ application:
116127
envFile:
117128
- path: relpath/to/env/file
118129
##### end
130+
119131
```
120132

121-
容器级的变量注入声明在 `application.services[*].containers[*].install` 中,表明在部署时,往对应的容器中注入对应变量。`env` `envFrom` 的规则与应用级一致。
133+
The container-level variable injection is declared in `application.services[*].containers[*].install`, indicating that the corresponding variables are injected into the corresponding container during deployment. The rules of `env` and `envFrom` are in line with the application level's.
122134

123135
<br/>
124136

125137
******
126138

127-
## 安装后自动端口转发
128-
范例:
139+
## Automatic port forwarding after installation
140+
141+
Example:
142+
129143
```yaml
130144
application:
131145
name: example
@@ -144,18 +158,21 @@ application:
144158
- 5005:5005
145159
- 3306:3306
146160
##### end
161+
147162
```
148163

149-
配置规则与容器及的变量注入声明类似,需要配置在 `application.services[*].containers[*].install` 中。
164+
The configuration rules are similar to the container and variable injection declarations, and need to be configured in `application.services[*].containers[*].install`.
150165

151-
安装后的端口转发顾名思义,在应用安装完毕,可以自动为某些服务做端口转发到本地,如常用的数据库、MQ 等端口,适合在安装完毕后自动转发,配置的规则。端口转发的规则与 K8s 一致,即 `本地端口:容器端口`
166+
The port forwarding after installation is as it's name implies. After the application is installed, it can automatically forward port to the local for some services. For instance, database, MQ and other commonly used services' ports are suitable for automatic forwarding and configuration rules after installation. The port forwarding rules are consistent with K8s, namely `local port: container port`.
152167

153168
<br/>
154169

155170
******
156171

157172
## Hook
158-
范例:
173+
174+
Example:
175+
159176
```yaml
160177
application:
161178
name: example
@@ -184,34 +201,40 @@ application:
184201
- path: manifest/templates/hook/post-delete.yaml
185202
weight: "1"
186203
##### end
204+
187205
```
188206

189207

190-
Nocalhost 支持在应用的生命周期注入各种 Hook,**Hook 目前只支持 Job**,其中 `path` 为**相对于主目录**的 RawManifest,必须是 Job 类型,`weight` 为权重,权重低的先执行。
208+
Nocalhost supports injecting various hooks in the life cycle of the application. **Hooks currently only support Job**, where `path` is the RawManifest **relative to the home directory**, which must be the job type. `weight` is the weight. The lower ones are executed first.
191209

192210
<br/>
193211

194-
:::danger Hook的限制
195-
Hook 与 Helm 的 Hook 类似,Hook 本身是为了弥补非 Helm 应用的不足,所以**Helm 类型应用无法配置 Hook(你可以直接使用 Helm 的 Hook)**。
212+
:::danger The limits on the Hook
213+
214+
Hook is similar to Helm's Hook. Hook itself is to make up for the shortcomings of non-Helm applications, so ** Helm-type applications cannot configure Hook (You can use Helm's Hook directly)**.
215+
196216
:::
197217

198218
<br/>
199219

200-
:::info Hook的解释
201-
- `onPreInstall` 发生在应用部署之前,例如执行集群、数据库之类的的一些初始化操作。会在 Job 状态为 `Successed` 后,才开始真正执行部署,如果失败,则安装终止。
202-
- `onPostInstall` 发生在应用部署之后,当所有资源都提交到 K8s Api Server,会执行此 Job,状态为 `Successed` 后,部署成功。否则将回滚,执行卸载操作。
220+
:::info The explanation of Hook
221+
222+
- `onPreInstall` occurs before the employment of the application, including performing some initialization operations such as clusters and databases. The deployment will start after the job status is `Successed`. If it fails, the installation will be terminated.
223+
- `onPostInstall` occurs after the application is deployed. When all resources are submitted to the K8s Api Server, this job will be executed. After the status is `Successed`, the deployment is successful. Otherwise, it will roll back and perform the uninstall operation.
203224

204225
<br/>
205226

206-
依次类推,UpgradeHook 和 DeleteHook 不同的是,它们在执行失败后都不会进行回滚,仅提示失败。
227+
By analogy, the Upgrade Hook and Delete Hook will not roll back after the execution fails, and only prompt failure.
207228
:::
208229

209230
<br/>
210231

211232
******
212233

213-
## HelmValues 的定制
214-
范例:
234+
## The customization of the HelmValues
235+
236+
Example:
237+
215238
```yaml
216239
application:
217240
name: example
@@ -231,11 +254,14 @@ application:
231254
deploy:
232255
example: {{ Release.Name }}
233256
##### end
257+
234258
```
235259

236260
<br/>
237261

238-
:::tip HelmValues 支持两种写法
239-
- 第一种写法仅支持纯字符串,优先级更高。
240-
- 第二种写法与 `values.yaml` 别无二致,可穿插 Helm 语法。
241-
:::
262+
:::tip HelmValues supports two kinds of syntax
263+
264+
- The first syntax only supports pure strings and has a higher priority.
265+
- The second syntax is the same as `values.yaml` and can be interspersed with Helm syntax.
266+
267+
:::

0 commit comments

Comments
 (0)