Skip to content

Commit cd51c84

Browse files
committed
[zh-cn] sync tasks/job/* configmap-secret/*
Signed-off-by: xin.li <[email protected]>
1 parent 52ecdb6 commit cd51c84

10 files changed

+65
-49
lines changed

content/zh-cn/docs/tasks/configmap-secret/managing-secret-using-config-file.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ parts of that configuration file during your deployment process.
147147
<!--
148148
For example, if your application uses the following configuration file:
149149
-->
150-
例如,如果你的应用程序使用以下配置文件:
150+
例如,如果你的应用程序使用以下配置文件
151151
152152
```yaml
153153
apiUrl: "https://my.api.com/api/v1"
@@ -158,7 +158,7 @@ password: "<password>"
158158
<!--
159159
You could store this in a Secret using the following definition:
160160
-->
161-
你可以使用以下定义将其存储在 Secret 中:
161+
你可以使用以下定义将其存储在 Secret 中
162162

163163
```yaml
164164
apiVersion: v1
@@ -173,6 +173,13 @@ stringData:
173173
password: <password>
174174
```
175175
176+
{{< note >}}
177+
<!--
178+
The `stringData` field for a Secret does not work well with server-side apply.
179+
-->
180+
Secret 的 `stringData` 字段不能很好地与服务器端应用配合使用。
181+
{{< /note >}}
182+
176183
<!--
177184
When you retrieve the Secret data, the command returns the encoded values,
178185
and not the plaintext values you provided in `stringData`.
@@ -231,6 +238,13 @@ stringData:
231238
username: administrator
232239
```
233240

241+
{{< note >}}
242+
<!--
243+
The `stringData` field for a Secret does not work well with server-side apply.
244+
-->
245+
Secret 的 `stringData` 字段不能很好地与服务器端应用配合使用。
246+
{{< /note >}}
247+
234248
<!--
235249
The `Secret` object is created as follows:
236250
-->

content/zh-cn/docs/tasks/configmap-secret/managing-secret-using-kustomize.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ secretGenerator:
5757
{{% tab name="文件" %}}
5858

5959
<!--
60-
1. Store the credentials in files with the values encoded in base64:
60+
1. Store the credentials in files. The filenames are the keys of the secret:
6161
-->
62-
1. 用 base64 编码的值存储凭据到文件中
62+
1. 将凭据存储在文件中。文件名是 Secret 的 key 值
6363

6464
```shell
6565
echo -n 'admin' > ./username.txt

content/zh-cn/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,21 +1320,21 @@ Xref: [Supported evaluation on CEL](https://github.com/google/cel-spec/blob/v0.6
13201320
-->
13211321
验证规则例子:
13221322
1323-
| 规则 | 目的 |
1324-
| ---------------- | ------------ |
1325-
| `self.minReplicas <= self.replicas && self.replicas <= self.maxReplicas` | 验证定义副本数的三个字段大小顺序是否正确 |
1326-
| `'Available' in self.stateCounts` | 验证 map 中是否存在键名为 `Available`的条目 |
1327-
| `(size(self.list1) == 0) != (size(self.list2) == 0)` | 验证两个 list 之一是非空的,但不是二者都非空 |
1328-
| <code>!('MY_KEY' in self.map1) &#124;&#124; self['MY_KEY'].matches('^[a-zA-Z]*$')</code> | 如果某个特定的 key 在 map 中,验证 map 中这个 key 的 value |
1329-
| `self.envars.filter(e, e.name = 'MY_ENV').all(e, e.value.matches('^[a-zA-Z]*$')` | 验证一个 listMap 中主键 'name' 为 'MY_ENV' 'value' 的表项,检查其取值 'value' |
1330-
| `has(self.expired) && self.created + self.ttl < self.expired` | 验证 'Expired' 日期是否晚于 'Create' 日期加上 'ttl' 持续时间 |
1331-
| `self.health.startsWith('ok')` | 验证 'health' 字符串字段有前缀 'ok' |
1332-
| `self.widgets.exists(w, w.key == 'x' && w.foo < 10)` | 验证 key 为 'x' 的 listMap 项的 'foo' 属性是否小于 10 |
1333-
| `type(self) == string ? self == '100%' : self == 1000` | 在 int 型和 string 型两种情况下验证 int-or-string 字段 |
1334-
| `self.metadata.name.startsWith(self.prefix)` | 验证对象的名称是否具有另一个字段值的前缀 |
1335-
| `self.set1.all(e, !(e in self.set2))` | 验证两个 listSet 是否不相交 |
1336-
| `size(self.names) == size(self.details) && self.names.all(n, n in self.details)` | 验证 'details' map 是由 'names' listSet 的项目所决定的。 |
1337-
| `size(self.clusters.filter(c, c.name == self.primary)) == 1` | 验证 'primary' 属性仅在 'clusters' listMap 中出现一次且只有一次 |
1323+
| 规则 | 目的 |
1324+
| ---------------- | ------------ |
1325+
| `self.minReplicas <= self.replicas && self.replicas <= self.maxReplicas` | 验证定义副本数的三个字段大小顺序是否正确 |
1326+
| `'Available' in self.stateCounts` | 验证映射中是否存在键名为 `Available`的条目 |
1327+
| `(size(self.list1) == 0) != (size(self.list2) == 0)` | 检查两个列表之一是非空的,但不是二者都非空 |
1328+
| <code>!('MY_KEY' in self.map1) &#124;&#124; self['MY_KEY'].matches('^[a-zA-Z]*$')</code> | 如果某个特定的键在映射中,验证映射中对应键的取值 |
1329+
| `self.envars.filter(e, e.name = 'MY_ENV').all(e, e.value.matches('^[a-zA-Z]*$')` | 验证一个 listMap 中主键 'name' 为 'MY_ENV' 的表项的取值 |
1330+
| `has(self.expired) && self.created + self.ttl < self.expired` | 验证 'Expired' 日期是否晚于 'Create' 日期加上 'ttl' 时长 |
1331+
| `self.health.startsWith('ok')` | 验证 'health' 字符串字段有前缀 'ok' |
1332+
| `self.widgets.exists(w, w.key == 'x' && w.foo < 10)` | 验证键为 'x' 的 listMap 项的 'foo' 属性是否小于 10 |
1333+
| `type(self) == string ? self == '100%' : self == 1000` | 在 int 型和 string 型两种情况下验证 int-or-string 字段 |
1334+
| `self.metadata.name.startsWith(self.prefix)` | 验证对象的名称是否以另一个字段值为前缀 |
1335+
| `self.set1.all(e, !(e in self.set2))` | 验证两个 listSet 是否不相交 |
1336+
| `size(self.names) == size(self.details) && self.names.all(n, n in self.details)` | 验证 'details' 映射中的 'names' 来自于 listSet |
1337+
| `size(self.clusters.filter(c, c.name == self.primary)) == 1` | 验证 'primary' 属性在 'clusters' listMap 中出现一次且只有一次 |
13381338
13391339
参考:[CEL 中支持的求值](https://github.com/google/cel-spec/blob/v0.6.0/doc/langdef.md#evaluation)
13401340

content/zh-cn/docs/tasks/job/automated-tasks-with-cron-jobs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Here is a manifest for a CronJob that runs a simple demonstration task every min
3838
CronJob 需要一个配置文件。
3939
以下是针对一个 CronJob 的清单,该 CronJob 每分钟运行一个简单的演示任务:
4040

41-
{{% code file="application/job/cronjob.yaml" %}}
41+
{{% code_sample file="application/job/cronjob.yaml" %}}
4242

4343
<!--
4444
Run the example CronJob by using this command:

content/zh-cn/docs/tasks/job/coarse-parallel-processing-work-queue.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,11 @@ root@temp-loe07:/# export BROKER_URL=amqp://guest:guest@rabbitmq-service:5672
212212

213213
root@temp-loe07:/# /usr/bin/amqp-declare-queue --url=$BROKER_URL -q foo -d foo
214214

215-
# 向它推送一条消息:
215+
# 向它推送一条消息
216216

217217
root@temp-loe07:/# /usr/bin/amqp-publish --url=$BROKER_URL -r foo -p -b Hello
218218

219-
# 然后取回它.
219+
# 然后取回它
220220

221221
root@temp-loe07:/# /usr/bin/amqp-consume --url=$BROKER_URL -q foo -c 1 cat && echo
222222
Hello
@@ -225,7 +225,8 @@ root@temp-loe07:/#
225225

226226
<!--
227227
In the last command, the `amqp-consume` tool takes one message (`-c 1`)
228-
from the queue, and passes that message to the standard input of an arbitrary command. In this case, the program `cat` prints out the characters read from standard input, and the echo adds a carriage
228+
from the queue, and passes that message to the standard input of an arbitrary command.
229+
In this case, the program `cat` prints out the characters read from standard input, and the echo adds a carriage
229230
return so the example is readable.
230231
-->
231232

@@ -302,12 +303,12 @@ example program:
302303
我们将用 `amqp-consume` 实用程序从队列中读取消息并运行实际的程序。
303304
这里给出一个非常简单的示例程序:
304305

305-
{{% code language="python" file="application/job/rabbitmq/worker.py" %}}
306+
{{% code_sample language="python" file="application/job/rabbitmq/worker.py" %}}
306307

307308
<!--
308309
Give the script execution permission:
309310
-->
310-
赋予脚本执行权限:
311+
赋予脚本执行权限
311312

312313
```shell
313314
chmod +x worker.py
@@ -371,7 +372,7 @@ image to match the name you used, and call it `./job.yaml`.
371372

372373
这里给出一个 Job 定义 YAML 文件。你将需要拷贝一份 Job 并编辑该镜像以匹配你使用的名称,保存为 `./job.yaml`
373374

374-
{{% code file="application/job/rabbitmq/job.yaml" %}}
375+
{{% code_sample file="application/job/rabbitmq/job.yaml" %}}
375376

376377
<!--
377378
In this example, each pod works on one item from the queue and then exits.
@@ -520,4 +521,3 @@ Job 也会显示为未完成。Job 将创建 Pod 并阻塞等待消息输入。
520521
当发生下面两种情况时,即使队列中所有的消息都处理完了,Job 也不会显示为完成状态:
521522
* 在 amqp-consume 命令拿到消息和容器成功退出之间的时间段内,执行杀死容器操作;
522523
* 在 kubelet 向 api-server 传回 Pod 成功运行之前,发生节点崩溃。
523-

content/zh-cn/docs/tasks/job/fine-parallel-processing-work-queue.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Start a temporary interactive pod for running the Redis CLI.
106106
-->
107107
## 使用任务填充队列
108108

109-
现在,让我们往队列里添加一些 “任务”。在这个例子中,我们的任务是一些将被打印出来的字符串。
109+
现在,让我们往队列里添加一些“任务”。在这个例子中,我们的任务是一些将被打印出来的字符串。
110110

111111
启动一个临时的可交互的 Pod 用于运行 Redis 命令行界面。
112112

@@ -192,9 +192,9 @@ called rediswq.py ([Download](/examples/application/job/redis/rediswq.py)).
192192
The "worker" program in each Pod of the Job uses the work queue
193193
client library to get work. Here it is:
194194
-->
195-
Job 中每个 Pod 内的 “工作程序” 使用工作队列客户端库获取工作。具体如下:
195+
Job 中每个 Pod 内的“工作程序” 使用工作队列客户端库获取工作。具体如下:
196196

197-
{{% code language="python" file="application/job/redis/worker.py" %}}
197+
{{% code_sample language="python" file="application/job/redis/worker.py" %}}
198198

199199
<!--
200200
You could also download [`worker.py`](/examples/application/job/redis/worker.py),
@@ -241,7 +241,7 @@ your app image with your project ID, and push to GCR. Replace
241241
`<project>` with your project ID.
242242
-->
243243
如果你使用的是 [Google Container Registry](https://cloud.google.com/tools/container-registry/)
244-
请先用你的 project ID 给你的镜像打上标签,然后 push 到 GCR 。请将 `<project>` 替换为你自己的 project ID。
244+
请先用你的 project ID 给你的镜像打上标签,然后 push 到 GCR。请将 `<project>` 替换为你自己的 project ID。
245245

246246
```shell
247247
docker tag job-wq-2 gcr.io/<project>/job-wq-2
@@ -257,7 +257,7 @@ Here is the job definition:
257257

258258
这是 Job 定义:
259259

260-
{{% code file="application/job/redis/job.yaml" %}}
260+
{{% code_sample file="application/job/redis/job.yaml" %}}
261261

262262
<!--
263263
Be sure to edit the job template to

content/zh-cn/docs/tasks/job/indexed-parallel-processing-static.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ To access the work item from the worker program, you have a few options:
8989
要从工作程序访问工作项,你有几个选项:
9090

9191
1. 读取 `JOB_COMPLETION_INDEX` 环境变量。Job
92-
{{< glossary_tooltip text="控制器" term_id="controller" >}}
93-
自动将此变量链接到包含完成索引的注解。
92+
{{< glossary_tooltip text="控制器" term_id="controller" >}}自动将此变量链接到包含完成索引的注解。
9493
2. 读取包含完整索引的文件。
9594
3. 假设你无法修改程序,你可以使用脚本包装它,
9695
该脚本使用上述任意方法读取索引并将其转换为程序可以用作输入的内容。
@@ -138,7 +137,7 @@ Here is a sample Job manifest that uses `Indexed` completion mode:
138137

139138
这是一个使用 `Indexed` 完成模式的示例 Job 清单:
140139

141-
{{% code language="yaml" file="application/job/indexed-job.yaml" %}}
140+
{{% code_sample language="yaml" file="application/job/indexed-job.yaml" %}}
142141

143142
<!--
144143
In the example above, you use the builtin `JOB_COMPLETION_INDEX` environment
@@ -169,7 +168,7 @@ like shown in the following example:
169168
[使用 Downward API 将注解值作为卷文件传递](/zh-cn/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#store-pod-fields)
170169
如下例所示:
171170

172-
{{% code language="yaml" file="application/job/indexed-job-vol.yaml" %}}
171+
{{% code_sample language="yaml" file="application/job/indexed-job-vol.yaml" %}}
173172

174173
<!--
175174
## Running the Job
@@ -186,9 +185,12 @@ kubectl apply -f https://kubernetes.io/examples/application/job/indexed-job.yaml
186185
```
187186

188187
<!--
189-
When you create this Job, the control plane creates a series of Pods, one for each index you specified. The value of `.spec.parallelism` determines how many can run at once whereas `.spec.completions` determines how many Pods the Job creates in total.
188+
When you create this Job, the control plane creates a series of Pods, one for each index you specified.
189+
The value of `.spec.parallelism` determines how many can run at once whereas `.spec.completions`
190+
determines how many Pods the Job creates in total.
190191
191-
Because `.spec.parallelism` is less than `.spec.completions`, the control plane waits for some of the first Pods to complete before starting more of them.
192+
Because `.spec.parallelism` is less than `.spec.completions`, the control plane waits for some
193+
of the first Pods to complete before starting more of them.
192194
-->
193195
当你创建此 Job 时,控制平面会创建一系列 Pod,你指定的每个索引都会运行一个 Pod。
194196
`.spec.parallelism` 的值决定了一次可以运行多少个 Pod,
@@ -294,4 +296,4 @@ The output is similar to:
294296

295297
```
296298
xuq
297-
```
299+
```

content/zh-cn/docs/tasks/job/job-with-pod-to-pod-communication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ To enable pod-to-pod communication using pod hostnames in a Job, you must do the
7373
要在某 Job 中启用使用 Pod 主机名的 Pod 间通信,你必须执行以下操作:
7474

7575
<!--
76-
1. Set up a [headless service](/docs/concepts/services-networking/service/#headless-services)
76+
1. Set up a [headless Service](/docs/concepts/services-networking/service/#headless-services)
7777
with a valid label selector for the pods created by your Job. The headless service must be in the same namespace as
7878
the Job. One easy way to do this is to use the `job-name: <your-job-name>` selector, since the `job-name` label will be automatically added by Kubernetes. This configuration will trigger the DNS system to create records of the hostnames of
7979
the pods running your Job.

content/zh-cn/docs/tasks/job/parallel-processing-expansion.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ this pattern fits more realistic use cases.
2828
本任务展示基于一个公共的模板运行多个{{< glossary_tooltip text="Jobs" term_id="job" >}}。
2929
你可以用这种方法来并行执行批处理任务。
3030

31-
在本任务示例中,只有三个工作条目:_apple__banana__cherry_
31+
在本任务示例中,只有三个工作条目:**apple****banana****cherry**
3232
示例任务处理每个条目时打印一个字符串之后结束。
3333

3434
参考[在真实负载中使用 Job](#using-jobs-in-real-workloads)了解更适用于真实使用场景的模式。
@@ -76,7 +76,7 @@ First, download the following template of a job to a file called `job-tmpl.yaml`
7676
-->
7777
首先,将以下作业模板下载到名为 `job-tmpl.yaml` 的文件中。
7878

79-
{{% code file="application/job/job-tmpl.yaml" %}}
79+
{{% code_sample file="application/job/job-tmpl.yaml" %}}
8080

8181
```shell
8282
# 使用 curl 下载 job-tmpl.yaml
@@ -101,8 +101,8 @@ variable, writing into a temporary directory named `jobs`. Run this now:
101101
-->
102102
### 基于模板创建清单
103103

104-
下面的 Shell 代码片段使用 `sed` 将字符串 `$ITEM` 替换为循环变量,并将结果
105-
写入到一个名为 `jobs` 的临时目录。
104+
下面的 Shell 代码片段使用 `sed` 将字符串 `$ITEM` 替换为循环变量,
105+
并将结果写入到一个名为 `jobs` 的临时目录。
106106

107107
```shell
108108
# 展开模板文件到多个文件中,每个文件对应一个要处理的条目
@@ -377,7 +377,7 @@ Kubernetes 接收清单文件并执行你所创建的 Job。
377377
kubectl delete job -l jobgroup=jobexample
378378
```
379379
-->
380-
### 清理 {#cleanup-2}
380+
### 清理 {#cleanup-2}
381381

382382
```shell
383383
# 删除所创建的 Job
@@ -437,7 +437,7 @@ you can check on all Pods for these templated Jobs with a single command.
437437
{{< glossary_tooltip text="标签" term_id="label" >}},以便能够将一个 Job
438438
的 Pod 与另一个 Job 的 Pod 区分开来。
439439

440-
在本例中,每个 Job 及其 Pod 模板有一个标签: `jobgroup=jobexample`
440+
在本例中,每个 Job 及其 Pod 模板有一个标签`jobgroup=jobexample`
441441

442442
Kubernetes 自身对标签名 `jobgroup` 没有什么要求。
443443
为创建自同一模板的所有 Job 使用同一标签使得我们可以方便地同时操作组中的所有作业。

content/zh-cn/docs/tasks/job/pod-failure-policy.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Pod 失效策略来避免不必要的 Pod 重启。
7272

7373
首先,基于配置创建一个 Job:
7474

75-
{{% code file="/controllers/job-pod-failure-policy-failjob.yaml" %}}
75+
{{% code_sample file="/controllers/job-pod-failure-policy-failjob.yaml" %}}
7676

7777
<!--
7878
by running:
@@ -150,7 +150,7 @@ node while the Pod is running on it (within 90s since the Pod is scheduled).
150150
-->
151151
1. 基于配置创建 Job:
152152

153-
{{% code file="/controllers/job-pod-failure-policy-ignore.yaml" %}}
153+
{{% code_sample file="/controllers/job-pod-failure-policy-ignore.yaml" %}}
154154

155155
<!--
156156
by running:
@@ -250,7 +250,7 @@ deleted pods, in the `Pending` phase, to a terminal phase
250250
-->
251251
1. 首先基于配置创建一个 Job:
252252

253-
{{% code file="/controllers/job-pod-failure-policy-config-issue.yaml" %}}
253+
{{% code_sample file="/controllers/job-pod-failure-policy-config-issue.yaml" %}}
254254

255255
<!--
256256
by running:

0 commit comments

Comments
 (0)