You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
51
51
@@ -132,6 +132,57 @@ metadata:
132
132
name: example-configmap-1-8mbdf7882g
133
133
```
134
134
135
+
<!--
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:
The generated ConfigMap can be examined with the following command:
157
+
-->
158
+
可以使用以下命令检查生成的 ConfigMap:
159
+
160
+
```shell
161
+
kubectl kustomize ./
162
+
```
163
+
164
+
<!--
165
+
The generated ConfigMap is:
166
+
-->
167
+
生成的 ConfigMap 为:
168
+
169
+
```yaml
170
+
apiVersion: v1
171
+
data:
172
+
FOO=Bar
173
+
kind: ConfigMap
174
+
metadata:
175
+
name: example-configmap-1-8mbdf7882g
176
+
```
177
+
178
+
<!--
179
+
Each variable in the `.env` file becomes a separate key in the ConfigMap that you generate. This is different from the previous example which embeds a file named `.properties` (and all its entries) as the value for a single key.
ConfigMaps can also be generated from literal key-value pairs. To generate a ConfigMap from a literal key-value pair, add an entry to the `literals` list in configMapGenerator. Here is an example of generating a ConfigMap with a data item from a key-value pair:
137
188
-->
@@ -171,6 +222,110 @@ metadata:
171
222
name: example-configmap-2-g2hdhfc6tk
172
223
```
173
224
225
+
<!--
226
+
To use a generated ConfigMap in a Deployment, reference it by the name of the configMapGenerator. Kustomize will automatically replace this name with the generated name.
227
+
228
+
This is an example deployment that uses a generated ConfigMap:
| commonLabels | map[string]string | labels to add to all resources and selectors |
1024
1229
| commonAnnotations | map[string]string | annotations to add to all resources |
1025
1230
| resources | []string | each entry in this list must resolve to an existing resource configuration file |
1026
-
| configmapGenerator | [][ConfigMapArgs](https://github.com/kubernetes-sigs/kustomize/blob/release-kustomize-v4.0/api/types/kustomization.go#L99) | Each entry in this list generates a ConfigMap |
1027
-
| secretGenerator | [][SecretArgs](https://github.com/kubernetes-sigs/kustomize/blob/release-kustomize-v4.0/api/types/kustomization.go#L106) | Each entry in this list generates a Secret |
1028
-
| generatorOptions | [GeneratorOptions](https://github.com/kubernetes-sigs/kustomize/blob/release-kustomize-v4.0/api/types/kustomization.go#L109) | Modify behaviors of all ConfigMap and Secret generator |
1231
+
| configMapGenerator | [][ConfigMapArgs](https://github.com/kubernetes-sigs/kustomize/blob/master/api/types/configmapargs.go#L7) | Each entry in this list generates a ConfigMap |
1232
+
| secretGenerator | [][SecretArgs](https://github.com/kubernetes-sigs/kustomize/blob/master/api/types/secretargs.go#L7) | Each entry in this list generates a Secret |
1233
+
| generatorOptions | [GeneratorOptions](https://github.com/kubernetes-sigs/kustomize/blob/master/api/types/generatoroptions.go#L7) | Modify behaviors of all ConfigMap and Secret generator |
1029
1234
| bases | []string | Each entry in this list should resolve to a directory containing a kustomization.yaml file |
1030
1235
| patchesStrategicMerge | []string | Each entry in this list should resolve a strategic merge patch of a Kubernetes object |
1031
-
| patchesJson6902 | [][Json6902](https://github.com/kubernetes-sigs/kustomize/blob/release-kustomize-v4.0/api/types/patchjson6902.go#L8) | Each entry in this list should resolve to a Kubernetes object and a Json Patch |
1032
-
| vars | [][Var](https://github.com/kubernetes-sigs/kustomize/blob/master/api/types/var.go#L31) | Each entry is to capture text from one resource's field |
1033
-
| images | [][Image](https://github.com/kubernetes-sigs/kustomize/tree/master/api/types/image.go#L23) | Each entry is to modify the name, tags and/or digest for one image without creating patches |
1236
+
| patchesJson6902 | [][Patch](https://github.com/kubernetes-sigs/kustomize/blob/master/api/types/patch.go#L10) | Each entry in this list should resolve to a Kubernetes object and a Json Patch |
1237
+
| vars | [][Var](https://github.com/kubernetes-sigs/kustomize/blob/master/api/types/var.go#L19) | Each entry is to capture text from one resource's field |
1238
+
| images | [][Image](https://github.com/kubernetes-sigs/kustomize/blob/master/api/types/image.go#L8) | Each entry is to modify the name, tags and/or digest for one image without creating patches |
1034
1239
| configurations | []string | Each entry in this list should resolve to a file containing [Kustomize transformer configurations](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/transformerconfigs) |
1035
1240
| crds | []string | Each entry in this list should resolve to an OpenAPI definition file for Kubernetes types |
0 commit comments