Skip to content

Instantly share code, notes, and snippets.

@cari-lynn
Last active May 8, 2020 21:24
Show Gist options
  • Save cari-lynn/961d793c165e1f3ecd9746038c947c2b to your computer and use it in GitHub Desktop.
Save cari-lynn/961d793c165e1f3ecd9746038c947c2b to your computer and use it in GitHub Desktop.
Appending a yaml string using an overlay
#@ 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
#@ load("@ytt:overlay", "overlay")
#@ load("@ytt:yaml", "yaml")
#@ def appendingStrings(existing, additional):
#@ return existing+additional
#@ end
#@overlay/match by=overlay.subset({"kind": "Secret", "metadata": {"name": "secret"}})
---
stringData:
#@overlay/replace via=appendingStrings
longYaml: |
fourth: a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment