docs(substitution): mention that all occurrences are replaced

Before it was unclear if all occurrences of a pattern were replaced
in a given target.

Change-Id: Ie02a54fef98a912b36b66891be8fed346ba5d9e0
This commit is contained in:
Dustin Specker 2018-11-29 11:17:51 -06:00
parent bf98dfdbbc
commit 815306ddf8
1 changed files with 26 additions and 1 deletions

View File

@ -208,7 +208,9 @@ the hood. The ``dest.pattern`` has the following constraints:
* The ``dest.pattern`` must be resolvable in the value of ``dest.path``. * The ``dest.pattern`` must be resolvable in the value of ``dest.path``.
If the above constraints are met, then more precise substitution via a pattern If the above constraints are met, then more precise substitution via a pattern
can be carried out. can be carried out. If ``dest.path`` is a string or multiline string then all
occurrences of ``dest.pattern`` found in ``dest.path`` will be replaced. To handle
a more complex ``dest.path`` read `Recursive Replacement of Patterns`_.
Example Example
^^^^^^^ ^^^^^^^
@ -226,6 +228,16 @@ Example
storagePolicy: cleartext storagePolicy: cleartext
data: my-secret-password data: my-secret-password
--- ---
# Another source document.
schema: deckhand/Passphrase/v1
metadata:
name: another-password
schema: metadata/Document/v1
layeringDefinition:
layer: site
storagePolicy: cleartext
data: another-secret-password
---
# Destination document. # Destination document.
schema: armada/Chart/v1 schema: armada/Chart/v1
metadata: metadata:
@ -241,12 +253,22 @@ Example
schema: deckhand/Passphrase/v1 schema: deckhand/Passphrase/v1
name: example-password name: example-password
path: . path: .
- dest:
path: .chart.values.script
pattern: INSERT_ANOTHER_PASSWORD
src:
schema: deckhand/Passphrase/v1
name: another-password
path: .
data: data:
chart: chart:
details: details:
data: here data: here
values: values:
some_url: http://admin:INSERT_PASSWORD_HERE@service-name:8080/v1 some_url: http://admin:INSERT_PASSWORD_HERE@service-name:8080/v1
script: |
some_function("INSERT_ANOTHER_PASSWORD")
another_function("INSERT_ANOTHER_PASSWORD")
After document rendering, the output for ``example-chart-01`` (the destination After document rendering, the output for ``example-chart-01`` (the destination
document) will be: document) will be:
@ -267,6 +289,9 @@ document) will be:
# Notice string replacement occurs at exact location specified by # Notice string replacement occurs at exact location specified by
# ``dest.pattern``. # ``dest.pattern``.
some_url: http://admin:my-secret-password@service-name:8080/v1 some_url: http://admin:my-secret-password@service-name:8080/v1
script: |
some_function("another-secret-password")
another_function("another-secret-password")
Recursive Replacement of Patterns Recursive Replacement of Patterns
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^