diff --git a/internal/ingress/controller/template/template.go b/internal/ingress/controller/template/template.go index c70406cf0..8628f8090 100644 --- a/internal/ingress/controller/template/template.go +++ b/internal/ingress/controller/template/template.go @@ -136,6 +136,13 @@ func cleanConf(in, out *bytes.Buffer) error { case ' ', '\t': needOutput = lineStarted case '\r': + rest := in.Bytes() + if len(rest) > 0 { + if rest[0] != '\n' { + c = ' ' + needOutput = lineStarted + } + } case '\n': needOutput = !(!lineStarted && emptyLineWritten) nextLineStarted = false @@ -150,6 +157,13 @@ func cleanConf(in, out *bytes.Buffer) error { case stateComment: switch c { case '\r': + rest := in.Bytes() + if len(rest) > 0 { + if rest[0] != '\n' { + c = ' ' + needOutput = lineStarted + } + } case '\n': needOutput = true nextLineStarted = false