Last active
February 28, 2021 05:38
-
-
Save making/1b4d1ff28dbb12914c20ded65ee48a59 to your computer and use it in GitHub Desktop.
ConfigMapのdata中のYAMLに対してoverlayを適用したい
This file contains hidden or 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
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: demo | |
data: | |
demo.yml: | | |
foo: 100 | |
bar: 200 |
This file contains hidden or 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 demo(): | |
foo: 500 | |
#@overlay/remove | |
bar: | |
#@overlay/match missing_ok=True | |
xyz: 300 | |
#@ end | |
#@overlay/match by=overlay.subset({"kind":"ConfigMap","metadata":{"name":"demo"}}) | |
--- | |
data: | |
#@overlay/replace via=lambda left,right: yaml.encode(overlay.apply(yaml.decode(left), demo())) | |
demo.yml: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment