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

[loki-distributed] [bug] wrong indent for server config #3459

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chuan99nd
Copy link

Bug Description

The server configuration in the Helm template was being incorrectly indented due to the use of an absolute indentation level (nindent 6). This caused issues when the server field and its nested configuration were parsed into a Go map and then re-generated as YAML. Since the indentation in YAML is relative to the parent field, using an absolute indentation level resulted in malformed YAML output.
Here is Configmap template

{{- if and (not .Values.loki.existingSecretForConfig) (not .Values.loki.configAsSecret) -}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "loki.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "loki.labels" . | nindent 4 }}
data:
  config.yaml: |
    {{- tpl (mergeOverwrite (tpl .Values.loki.config . | fromYaml) .Values.loki.structuredConfig | toYaml) . | nindent 4 }}
{{- end -}}

You can see other case similer in values.yaml file

    {{- if .Values.loki.schemaConfig}}
    schema_config:
    {{- toYaml .Values.loki.schemaConfig | nindent 2}}
    {{- end}}

Testing

Verified that the generated YAML now has the correct relative indentation under the server field.
Ensured that the fix does not introduce any regression in other parts of the configuration.

@CLAassistant
Copy link

CLAassistant commented Nov 28, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ chuan99nd
❌ chuanteko
You have signed the CLA already but the status is still pending? Let us recheck it.

@chuan99nd chuan99nd changed the title [loki-distributed] wrong indent for server config [loki-distributed] [bug] wrong indent for server config Nov 28, 2024
@chuan99nd chuan99nd force-pushed the chuannd1999-fix-loki-distributed-config branch from a28fd6d to b9e1451 Compare November 28, 2024 12:50
Signed-off-by: chuannd1999 <chuannd1999@gmail.com>
Signed-off-by: Tran Hoang Chuan <chuan.th@teko.vn>
@chuan99nd chuan99nd force-pushed the chuannd1999-fix-loki-distributed-config branch from b9e1451 to 1ceef4b Compare November 28, 2024 12:56
@Sheikh-Abubaker Sheikh-Abubaker added the bug Something isn't working label Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants