Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

662
Visualizações
Helm convert data for nginx template

Im using the following file by helm

apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-cfg
data:
  default.conf: |-
  {{ .Files.Get "config/nginx.conf" | nindent 4 }}

and I got the following error:

Error: YAML parse error on ops/templates/config/nginx.conf: error converting YAML to JSON: yaml: line 4: mapping values are not allowed in this context

The nginx file looks like following

nginx.conf

server {
    listen       80;
    listen  [::]:80;
    server_name: {{ print "kiftb." .Values.global.host | quote }} // this is the error line
...

The line with the sever_name create the error.

Any idea how to solve it?

update

As suggested by @Evan I've tried to remove the colon,

server_name {{ print "kiftb." .Values.global.host | quote }}

And I got an error:

error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type releaseutil.SimpleHead
helm.go:81: [debug] error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type releaseutil.SimpleHead

Any Idea how to overcome this? is there any workaround ?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Try removing the colon after server_name.

server_name {{ print "kiftb." .Values.global.host | quote }}

...

over 4 years ago · Santiago Trujillo Relatório

0

Sounds like you put the conf file in a wrong path. Helm deals with all the files inside ${chart_path}/templates/ as template or tpl files, which should be composed in YAML file. So basically you are facing the issue that helm are trying to parse ops/templates/config/nginx.conf as a template file, and definitely it will fail. The solution would be: move your conf file out of the path ops/templates, use ops/config/nginx.conf would be fine, and you even do not need change anything in your configmap script, it will work.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda