Skip to content

Commit a7daeaa

Browse files
author
Mengjiao Liu
committed
[zh]Sync kustomization.md
1 parent 9e3fa7b commit a7daeaa

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

content/zh/docs/tasks/manage-kubernetes-objects/kustomization.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,28 @@ metadata:
133133
```
134134
135135
<!--
136-
To generate a ConfigMap from an env file, add an entry to the `envs` list in `configMapGenerator`. Here is an example of generating a ConfigMap with a data item from a `.env` file:
136+
To generate a ConfigMap from an env file, add an entry to the `envs` list in `configMapGenerator`. This can also be used to set values from local environment variables by omitting the `=` and the value.
137137
-->
138138
要从 env 文件生成 ConfigMap,请在 `configMapGenerator` 中的 `envs` 列表中添加一个条目。
139+
这也可以用于通过省略 `=` 和值来设置本地环境变量的值。
140+
141+
<!--
142+
It's recommended to use the local environment variable population functionality sparingly - an overlay with a patch is often more maintainable. Setting values from the environment may be useful when they cannot easily be predicted, such as a git SHA.
143+
-->
144+
建议谨慎使用本地环境变量填充功能 —— 用补丁覆盖通常更易于维护。
145+
当无法轻松预测变量的值时,从环境中设置值可能很有用,例如 git SHA。
146+
147+
<!--
148+
Here is an example of generating a ConfigMap with a data item from a `.env` file:
149+
-->
139150
下面是一个用来自 `.env` 文件的数据生成 ConfigMap 的例子:
140151

141152
```shell
142153
# 创建一个 .env 文件
154+
# BAZ 将使用本地环境变量 $BAZ 的取值填充
143155
cat <<EOF >.env
144156
FOO=Bar
157+
BAZ
145158
EOF
146159
147160
cat <<EOF >./kustomization.yaml
@@ -158,7 +171,7 @@ The generated ConfigMap can be examined with the following command:
158171
可以使用以下命令检查生成的 ConfigMap:
159172

160173
```shell
161-
kubectl kustomize ./
174+
BAZ=Qux kubectl kustomize ./
162175
```
163176

164177
<!--
@@ -169,10 +182,11 @@ The generated ConfigMap is:
169182
```yaml
170183
apiVersion: v1
171184
data:
185+
BAZ: Qux
172186
FOO: Bar
173187
kind: ConfigMap
174188
metadata:
175-
name: example-configmap-1-42cfbf598f
189+
name: example-configmap-1-892ghb99c8
176190
```
177191

178192
<!--
@@ -398,7 +412,7 @@ type: Opaque
398412
```
399413

400414
<!--
401-
Like ConfigMaps, generated Secrets can be used in Deployments by refering to the name of the secretGenerator:
415+
Like ConfigMaps, generated Secrets can be used in Deployments by referring to the name of the secretGenerator:
402416
-->
403417
与 ConfigMaps 一样,生成的 Secrets 可以通过引用 secretGenerator 的名称在部署中使用:
404418

0 commit comments

Comments
 (0)