Skip to content

Configmaps Missing Trailing Newlines #4537

@drew-merryman

Description

@drew-merryman

Environment

App version: v0.63.0+

Steps to reproduce

  1. Add a configmap in a helm chart
  2. Deploy this helm chart through zarf
  3. Inspect the deployed configmap (i.e. kubectl get cm my-configmap -o json)

Expected result

Configmap values should end in a newline

Actual Result

Configmap value has the trailing newline chomped

Visual Proof (screenshots, videos, text, etc)

Consider the following configmap in a helm chart:

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: needs-new-line
data:
  mykey: |
    this value should have a newline at the end

When deployed directly via helm v3.19.4, I see the following when inspecting:

kubectl get cm -n default needs-new-line -o json
...
    "data": {
        "mykey": "this value should have a newline at the end\n"
    },
...

However, if this helm chart is deployed via zarf, inspecting shows this cm is stored differently:

kubectl get cm -n default needs-new-line -o json
...
        "mykey": "this value should have a newline at the end"
...

Additional Context

This seems to be the case for any configmap in any helm chart. A simple zarf.yaml I've been using to debug has been:

kind: ZarfPackageConfig
metadata:
  name: newline-repro
components:
  - name: chart-test
    required: true
    charts:
      - name: my-chart
        version: 1.0.0
        namespace: default
        localPath: ./my-chart

The behavior starts in zarf v0.63.0 (that is, zarf v0.62.0 is the last one where the new line is present in the json output). As far as I can tell, v0.63.0 and v0.62.0 use the same helm version underneath (zarf tools helm version shows v3.18.4).
This is pure speculation, but is there a zarf mechanism that renders helm templates before deploying that might be dropping the trailing newline?

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions