mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Tweak documentation on directive.
This commit is contained in:
@@ -212,11 +212,13 @@ crds:
|
|||||||
- crds/typeA.yaml
|
- crds/typeA.yaml
|
||||||
- crds/typeB.yaml
|
- crds/typeB.yaml
|
||||||
|
|
||||||
# Vars are used to insert values from resources that cannot be referenced
|
# Vars are used to capture text from one resource's field
|
||||||
# otherwise. For example if you need to pass a Service's name to the arguments
|
# and insert that text elsewhere.
|
||||||
# or environment variables of a program but without hard coding the actual name
|
#
|
||||||
# of the Service you'd insert `$(MY_SERVICE_NAME)` into the value field of the
|
# For example, suppose one specify the name of a k8s Service
|
||||||
# env var or into the command or args of the container as shown here:
|
# object in a container's command line, and the name of a
|
||||||
|
# k8s Secret object in a container's environment variable,
|
||||||
|
# so that the following would work:
|
||||||
# ```
|
# ```
|
||||||
# containers:
|
# containers:
|
||||||
# - image: myimage
|
# - image: myimage
|
||||||
@@ -226,19 +228,8 @@ crds:
|
|||||||
# value: $(SOME_SECRET_NAME)
|
# value: $(SOME_SECRET_NAME)
|
||||||
# ```
|
# ```
|
||||||
#
|
#
|
||||||
# Then you'll add an entry to `vars:` like shown below with the same name
|
# To do so, add an entry to `vars:` as follows:
|
||||||
# and a reference to the resource from which to pull the field's value.
|
|
||||||
# The actual field's path is optional and by default it will use
|
|
||||||
# `metadata.name`. Currently only string type fields are supported, no integers
|
|
||||||
# or booleans, etc. Also array access is currently not possible. For example getting
|
|
||||||
# the image field of container number 2 inside of a pod can currently not be done.
|
|
||||||
#
|
#
|
||||||
# Not every location of a variable is supported. To see a complete list of locations
|
|
||||||
# see the file [varreference.go](https://github.com/kubernetes-sigs/kustomize/blob/master/pkg/transformers/config/defaultconfig/varreference.go#L20).
|
|
||||||
#
|
|
||||||
# An example of a situation where you'd not use vars is when you'd like to set a
|
|
||||||
# pod's `serviceAccountName`. In that case you would just reference the ServiceAccount
|
|
||||||
# by name and Kustomize will resolve it to the eventual name while building the manifests.
|
|
||||||
vars:
|
vars:
|
||||||
- name: SOME_SECRET_NAME
|
- name: SOME_SECRET_NAME
|
||||||
objref:
|
objref:
|
||||||
@@ -259,6 +250,34 @@ vars:
|
|||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
fieldref:
|
fieldref:
|
||||||
fieldpath: spec.template.spec.restartPolicy
|
fieldpath: spec.template.spec.restartPolicy
|
||||||
|
#
|
||||||
|
# A var is a tuple of variable name, object reference and field
|
||||||
|
# reference within that object. That's where the text is found.
|
||||||
|
#
|
||||||
|
# The field reference is optional; it defaults to `metadata.name`,
|
||||||
|
# a normal default, since kustomize is used to generates or
|
||||||
|
# modify the names of resources.
|
||||||
|
#
|
||||||
|
# At time of writing, only string type fields are supported.
|
||||||
|
# No ints, bools, arrays etc. It's not possible to, say,
|
||||||
|
# extract the name of the image in container number 2 of
|
||||||
|
# some pod template.
|
||||||
|
#
|
||||||
|
# A variable reference, i.e. the string '$(FOO)', can only
|
||||||
|
# be placed in particular fields of particular objects as
|
||||||
|
# specified by kustomize's configuration data.
|
||||||
|
#
|
||||||
|
# The default config data for vars is at
|
||||||
|
# https://github.com/kubernetes-sigs/kustomize/blob/master/pkg/transformers/config/defaultconfig/varreference.go
|
||||||
|
# Long story short, the default targets are all
|
||||||
|
# container command args and env value fields.
|
||||||
|
#
|
||||||
|
# Vars should _not_ be used for inserting names in places
|
||||||
|
# where kustomize is already handling that job. E.g.,
|
||||||
|
# a Deployment may reference a ConfigMap by name, and
|
||||||
|
# if kustomize changes the name of a ConfigMap, it knows
|
||||||
|
# to change the name reference in the Deployment.
|
||||||
|
|
||||||
|
|
||||||
# Images modify the name, tags and/or digest for images without creating patches.
|
# Images modify the name, tags and/or digest for images without creating patches.
|
||||||
# E.g. Given this kubernetes Deployment fragment:
|
# E.g. Given this kubernetes Deployment fragment:
|
||||||
|
|||||||
Reference in New Issue
Block a user