Created
May 8, 2020 21:43
-
-
Save cari-lynn/abcc8bffa86c1813b9eb893072246f49 to your computer and use it in GitHub Desktop.
Append to a string as yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:data", "data") | |
--- | |
#! Input | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: secret | |
stringData: | |
longYaml: | | |
--- | |
first: [a, b, c] | |
second: | |
foo: bar | |
ree: baz | |
third: true | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:overlay", "overlay") | |
#@ load("@ytt:yaml", "yaml") | |
#@ def applyToYamlString(left, right): | |
#@ leftYaml = yaml.decode(left) | |
#@ new = overlay.apply(leftYaml, right) | |
#@ return yaml.encode(new) | |
#@ end | |
#@overlay/match by=overlay.subset({"kind": "Secret", "metadata": {"name": "secret"}}) | |
--- | |
stringData: | |
#@overlay/replace via=applyToYamlString | |
longYaml: | |
#@overlay/match missing_ok=True | |
fourth: | |
blah: dee | |
doo: bee | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment