Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gateway/configmap-gateway.yaml] error converting YAML to JSON: yaml: line 9: did not find expected comment or line break #15143

Open
wwyhy opened this issue Nov 27, 2024 · 0 comments

Comments

@wwyhy
Copy link

wwyhy commented Nov 27, 2024

Hello,

I am trying to install grafana/loki helm chart (version 6.21.0), but get error during gateway configmap render.
https://artifacthub.io/packages/helm/grafana/loki

If changed the template from "{{- tpl .Values.gateway.nginxConfig.file . | indent 2 }}" to {{- tpl .Values.gateway.nginxConfig.file . | nindent 4 }},
it works fine, but we cannot change the Chart, so could you please help on how can i adjust the value to make it works? thanks!
or is this a issue about the configmap template?

Reproduce:

# cat value.yaml
gateway:
  enabled: true
  replicas: 3
  verboseLogging: true
  nginxConfig:
    file: |
      worker_processes  5;
      error_log  /dev/stderr;
      pid        /tmp/nginx.pid;
      worker_rlimit_nofile 8192;
     
## Refer: https://github.com/grafana/loki/blob/main/production/helm/loki/templates/gateway/configmap-gateway.yaml
# cat configmap.yaml
{{- if and .Values.gateway.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: gateway
  namespace: monitoring
  labels:
    app: gateway
data:
  nginx.conf: |
    {{- tpl .Values.gateway.nginxConfig.file . | indent 2 }}
{{- end }}
# cat Chart.yaml
apiVersion: v2
appVersion: 3.3.0
description: Helm chart for Grafana Loki and Grafana Enterprise Logs supporting both
  simple, scalable and distributed modes.
home: https://grafana.github.io/helm-charts
icon: https://grafana.com/docs/loki/latest/logo_and_name.png
maintainers:
- name: trevorwhitney
- name: jeschkies
name: loki
sources:
- https://github.com/grafana/loki
- https://grafana.com/oss/loki/
- https://grafana.com/docs/loki/latest/
type: application
version: 6.21.0
# ls
Chart.yaml templates  value.yaml
# ls templates/
confimap.yaml
# helm template . --values ./value.yaml --debug
install.go:222: [debug] Original chart version: ""
install.go:239: [debug] CHART PATH: /tmp/a

---
# Source: loki/templates/confimap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: gateway
  namespace: monitoring
  labels:
    app: gateway
data:
  nginx.conf: |  worker_processes  5;
  error_log  /dev/stderr;
  pid        /tmp/nginx.pid;
  worker_rlimit_nofile 8192;
Error: YAML parse error on loki/templates/confimap.yaml: error converting YAML to JSON: yaml: line 9: did not find expected comment or line break
helm.go:84: [debug] error converting YAML to JSON: yaml: line 9: did not find expected comment or line break
YAML parse error on loki/templates/confimap.yaml

Thanks!

@wwyhy wwyhy changed the title error converting YAML to JSON: yaml: line 9: did not find expected comment or line break [gateway/configmap-gateway.yaml] error converting YAML to JSON: yaml: line 9: did not find expected comment or line break Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant