How To Insert a Non Yaml file with Ytt #359
-
Im looking for a way in ytt to easily do the following (pseudocode). I can see that
Currently I have this working with
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
as long as your ytt invocation includes necessary file (nginx.conf) in -f flags, then you can use invocation would look something like this on a chance that you need to template variables inside nginx.conf itself take a look at text templating example: https://carvel.dev/ytt/#example:example-text-template |
Beta Was this translation helpful? Give feedback.
-
Thanks for this. using this markup...results
results in
notice the
How do i get just
|
Beta Was this translation helpful? Give feedback.
-
the reason why you are getting array item is because you are specifying to add this content as an array item (ie dash in YAML adds an array item in #@ load("@ytt:overlay", "overlay")
#@ load("@ytt:data", "data")
#@overlay/match by=overlay.all, expects="1+"
---
configMaps:
#@overlay/match by="name"
- name: a-configmap
data:
#@overlay/match missing_ok=True
nginx-conf: #@ data.read("nginx.conf") if you are actually trying to "combine" all files that end with .conf, then it could be like this (uses comprehensions) #@ load("@ytt:overlay", "overlay")
#@ load("@ytt:data", "data")
#@overlay/match by=overlay.all, expects="1+"
---
configMaps:
#@overlay/match by="name"
- name: a-configmap
data:
#@overlay/match missing_ok=True
nginx-conf: #@ "\n".join([ data.read(f) for f in data.list() if f.endswith(".conf") ]) |
Beta Was this translation helpful? Give feedback.
-
Fantastic thankyou.. |
Beta Was this translation helpful? Give feedback.
the reason why you are getting array item is because you are specifying to add this content as an array item (ie dash in YAML adds an array item in
- #@ data.read(file)
). if you just have a single file called nginx.conf it should just be:if you are actually trying to "combine" all files that end with .conf, then it could be like this (uses comprehensions)