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
Copy file name to clipboardExpand all lines: docs/kustomization.yaml
+36-17Lines changed: 36 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -212,11 +212,13 @@ crds:
212
212
- crds/typeA.yaml
213
213
- crds/typeB.yaml
214
214
215
-
# Vars are used to insert values from resources that cannot be referenced
216
-
# otherwise. For example if you need to pass a Service's name to the arguments
217
-
# or environment variables of a program but without hard coding the actual name
218
-
# of the Service you'd insert `$(MY_SERVICE_NAME)` into the value field of the
219
-
# env var or into the command or args of the container as shown here:
215
+
# Vars are used to capture text from one resource's field
216
+
# and insert that text elsewhere.
217
+
#
218
+
# For example, suppose one specify the name of a k8s Service
219
+
# object in a container's command line, and the name of a
220
+
# k8s Secret object in a container's environment variable,
221
+
# so that the following would work:
220
222
# ```
221
223
# containers:
222
224
# - image: myimage
@@ -226,19 +228,8 @@ crds:
226
228
# value: $(SOME_SECRET_NAME)
227
229
# ```
228
230
#
229
-
# Then you'll add an entry to `vars:` like shown below with the same name
230
-
# and a reference to the resource from which to pull the field's value.
231
-
# The actual field's path is optional and by default it will use
232
-
# `metadata.name`. Currently only string type fields are supported, no integers
233
-
# or booleans, etc. Also array access is currently not possible. For example getting
234
-
# the image field of container number 2 inside of a pod can currently not be done.
235
-
#
236
-
# Not every location of a variable is supported. To see a complete list of locations
237
-
# see the file [varreference.go](https://github.com/kubernetes-sigs/kustomize/blob/master/pkg/transformers/config/defaultconfig/varreference.go#L20).
231
+
# To do so, add an entry to `vars:` as follows:
238
232
#
239
-
# An example of a situation where you'd not use vars is when you'd like to set a
240
-
# pod's `serviceAccountName`. In that case you would just reference the ServiceAccount
241
-
# by name and Kustomize will resolve it to the eventual name while building the manifests.
242
233
vars:
243
234
- name: SOME_SECRET_NAME
244
235
objref:
@@ -259,6 +250,34 @@ vars:
259
250
apiVersion: apps/v1
260
251
fieldref:
261
252
fieldpath: spec.template.spec.restartPolicy
253
+
#
254
+
# A var is a tuple of variable name, object reference and field
255
+
# reference within that object. That's where the text is found.
256
+
#
257
+
# The field reference is optional; it defaults to `metadata.name`,
258
+
# a normal default, since kustomize is used to generates or
259
+
# modify the names of resources.
260
+
#
261
+
# At time of writing, only string type fields are supported.
262
+
# No ints, bools, arrays etc. It's not possible to, say,
263
+
# extract the name of the image in container number 2 of
264
+
# some pod template.
265
+
#
266
+
# A variable reference, i.e. the string '$(FOO)', can only
267
+
# be placed in particular fields of particular objects as
0 commit comments