22title : " vars"
33linkTitle : " vars"
44type : docs
5- weight : 22
5+ weight : 23
66description : >
77 Substitute name references.
88---
@@ -11,7 +11,7 @@ description: >
1111
1212WARNING: There are plans to deprecate vars. For existing users of vars, we recommend migration to [ replacements]
1313as early as possible. There is a guide for convering vars to replacements at the bottom of this page under
14- "convert vars to replacements". For new users, we recommend never using vars, and starting with replacements
14+ "convert vars to replacements". For new users, we recommend never using vars, and starting with replacements
1515to avoid migration in the future.
1616
1717Vars are used to capture text from one resource's field
@@ -134,7 +134,7 @@ vars:
134134In order to convert `vars` to `replacements`, we have to :
135135 1. Replace every instance of $(SOME_SECRET_NAME) with any arbitrary placeholder value.
136136 2. Convert the vars `objref` field to a [replacements] `source` field.
137- 3. Replace the vars `name` fied with a [replacements] `targets` field that points to
137+ 3. Replace the vars `name` fied with a [replacements] `targets` field that points to
138138every instance of the placeholder value in step 1.
139139
140140In our simple example here, this would look like the following :
@@ -169,7 +169,7 @@ replacements:
169169 name: my-secret
170170 version: v1
171171 targets:
172- - select:
172+ - select:
173173 kind: Pod
174174 name: my-pod
175175 fieldPaths:
@@ -178,9 +178,9 @@ replacements:
178178
179179# ### More complex migration example
180180
181- Let's take a more complex usage of vars and convert it to [replacements]. We are going
181+ Let's take a more complex usage of vars and convert it to [replacements]. We are going
182182to convert the vars in the [wordpress example](https://github.com/kubernetes-sigs/kustomize/tree/master/examples/wordpress)
183- to replacements.
183+ to replacements.
184184
185185The wordpress example has the following directory structure :
186186
@@ -228,15 +228,15 @@ spec:
228228 ` ` `
229229
230230and the top level `kustomization.yaml` has the following contents :
231-
231+
232232 ` ` `
233233 resources:
234234 - wordpress
235235 - mysql
236236 patchesStrategicMerge:
237237 - patch.yaml
238238 namePrefix: demo-
239-
239+
240240 vars:
241241 - name: WORDPRESS_SERVICE
242242 objref:
@@ -255,7 +255,7 @@ In this example, the patch is used to:
255255- Add environment variable that allow wordpress to find the mysql database
256256
257257We can convert vars to replacements in this more complex case too, by taking the same steps as
258- the previous example. To do this, we can change the contents of `patch.yaml` to :
258+ the previous example. To do this, we can change the contents of `patch.yaml` to :
259259
260260` ` ` yaml
261261apiVersion: apps/v1
@@ -283,7 +283,7 @@ spec:
283283
284284 ` ` `
285285
286- Then, in our kustomization, we can have our replacements :
286+ Then, in our kustomization, we can have our replacements :
287287
288288` kustomization.yaml`
289289
@@ -296,22 +296,22 @@ patchesStrategicMerge:
296296namePrefix: demo-
297297
298298replacements:
299- - source:
299+ - source:
300300 name: demo-wordpress
301301 kind: Service
302302 version: v1
303303 targets:
304- - select:
304+ - select:
305305 kind: Deployment
306306 name: demo-wordpress
307307 fieldPaths:
308308 - spec.template.spec.initContainers.[name=init-command].args.2
309- - source:
309+ - source:
310310 name: demo-mysql
311311 kind: Service
312312 version: v1
313313 targets:
314- - select:
314+ - select:
315315 kind: Deployment
316316 name: demo-wordpress
317317 fieldPaths:
0 commit comments