Skip to content

How To Insert a Non Yaml file with Ytt #359

Answered by cppforlife
pingcrosby asked this question in Q&A
Discussion options

You must be logged in to vote

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:

#@ 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/…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by cppforlife
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #350 on April 16, 2021 14:13.