Skip to content

Haproxy Helm Chart configmap strips because the use of |- #344

@bmm-alc

Description

@bmm-alc

Hello,

I observe on all cluster where I deployed haproxy the configMap which contains haproxy configuration make the pods fail to start.
I constantly get this error

 haproxy version is 3.3.5-f0a2d1bf5                                                                                                
 config : parsing [/usr/local/etc/haproxy/haproxy.cfg:193]: Missing LF on last line, file might have been truncated at position 31.
 config : Error(s) found in configuration file : /usr/local/etc/haproxy/haproxy.cfg                                                
 config : Fatal errors found in configuration. 

I found the configMap is defined this way

data:
  haproxy.cfg: |2-

    global
      log stdout format raw local0
      stats timeout 1s
      user haproxy
      group haproxy

      ...
(omited)

so the last line is stripped

the characters 2- is added but I don't know which component do this (the haproxy chart, helm, etcd, kubernetes).
using haproxy.cfg: |+ in the values.yaml files does not fix the issue, the configMap still has haproxy.cfg: |2-.

but I found if I modify the file templates/configmap.yaml this way it works

diff --git a/haproxy/templates/configmap.yaml b/haproxy/templates/configmap.yaml
index e1847b2..35c8b83 100644
--- a/haproxy/templates/configmap.yaml
+++ b/haproxy/templates/configmap.yaml
@@ -23,7 +23,7 @@ metadata:
   labels:
   {{- include "haproxy.labels" . | nindent 4 }}
 data:
-  {{ .Values.configMount.subPath | default "haproxy.cfg" }}: |
+  {{ .Values.configMount.subPath | default "haproxy.cfg" }}: |+
   {{ tpl .Values.config . | nindent 4 }}
 {{- end }}

Do you have an idea on such bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions