Skip to content

Create configmap from existing file #277

Answered by StevenLocke
mhubig asked this question in Q&A
Discussion options

You must be logged in to vote

Hi! 👋

From what I gather, you're looking for a way to import a JS file into a YAML file.

There's a (probably not what you want) way of simply importing the file as a string, which can be done with the data.read function.

#@ load("@ytt:data", "data")

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: renovate-config
  namespace: renovate
  annotations:
    kapp.k14s.io/versioned: ""
    kapp.k14s.io/num-versions: "10"
data:
  config.js: #@ data.read("config.js")

Resulting in:

apiVersion: v1
kind: ConfigMap
metadata:
  name: renovate-config
  namespace: renovate
  annotations:
    kapp.k14s.io/versioned: ""
    kapp.k14s.io/num-versions: "10"
data:
  config.js: |-
    module.exports = {

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mhubig
Comment options

Answer selected by mhubig
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