Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

helm configmap include client script in values.yaml

I have to include the client script file as configmap and mount to pod how to create configmap for below structure in values.yaml

app:
  server:
    client-cli1.sh: |
      #!/bin/bash
      echo "Hello World"
    client-cli2.sh: |
      #!/bin/bash
      echo "Hello World"

this is configmap file

apiVersion: v1
kind: ConfigMap
metadata:
  name: cli-config
data: 
{{ range  $key, $val:= .Values.app.server }}
  {{ $key }}: |
    {{ $val  }}
{{ end }}

i am getting error "error converting YAML to JSON: yaml: line 14: could not find expected ':'" Note: cant change structure and cant use File function because the build happen somewhere else only values.ymal will be provided.

how to parse this.

like image 907
user1184777 Avatar asked Jul 09 '26 16:07

user1184777


1 Answers

Try this:

apiVersion: v1
kind: ConfigMap
metadata:
  name: cli-config
data: 
{{ toYaml .Values.app.server | indent 2 }}
like image 53
Vasili Angapov Avatar answered Jul 11 '26 12:07

Vasili Angapov