Skip to content

specifying runAsUser 0 in additionalContainers is treated as false #1521

@SampsonCrowley

Description

@SampsonCrowley

Describe the bug

specifying a root user runner for images that require it is ignored.

{{- if or $additionalContainers.runAsUser $.Values.agent.runAsUser }}
runAsUser: {{ $additionalContainers.runAsUser | default $.Values.agent.runAsUser }}
{{- end }}
{{- if or $additionalContainers.runAsGroup $.Values.agent.runAsGroup }}
runAsGroup: {{ $additionalContainers.runAsGroup | default $.Values.agent.runAsGroup }}
{{- end }}

this only does a falsey check which will always return false for 0

Version of Helm and Kubernetes

- Helm: version.BuildInfo{Version:"v3.18.3", GitCommit:"6838ebcf265a3842d1433956e8a622e3290cf324", GitTreeState:"clean", GoVersion:"go1.24.4"}
- Kubernetes:
  Client Version: v1.34.1
  Kustomize Version: v5.4.2
  Server Version: v1.33.5-eks-113cf36

Chart version

5.8.64

What happened?

1. set additionalContainer[0].runAsUser = 0
2. no value is set at all in deployed config
3. does not need a truthy global runAsUser to reproduce

What you expected to happen?

the additional container should explicitly set 0

How to reproduce it

agent:
  additionalContainers:
    - sideContainerName: dind
      image:
        repository: docker
        tag: 26-dind
      command: dockerd-entrypoint.sh
      runAsUser: 0

Anything else we need to know?

Related issues: helm/helm#3164

Seems as though the correct solution would be to call toString <optionalvalue> to guarantee explicit 0 is parsed correctly

using runAsUser: "0" seems to work

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions