Skip to content

[BUG] helm create will create wrong automountServiceAccountToken #12432

@larszi

Description

@larszi

If you create a new Chart wit the command helm create <chartName>

The Default Service Account will be created wrong:
Output of ServiceAccount yaml:

{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ include "helmhart.serviceAccountName" . }}
  labels:
    {{- include "helmhart.labels" . | nindent 4 }}
  {{- with .Values.serviceAccount.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}


Expected:

{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ include "helmhart.serviceAccountName" . }}
  labels:
    {{- include "helmhart.labels" . | nindent 4 }}
  {{- with .Values.serviceAccount.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}

Note that the automountServiceAccountToken is going under ServiceAccount.metadata.automountServiceAccountToken. Expected would be ServiceAccount.automountServiceAccountToken.

This will lead to the following Error:
Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(ServiceAccount.metadata): unknown field "automountServiceAccountToken" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta

Ref to the Kubernets Doc: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#opt-out-of-api-credential-automounting

Output of helm version:
version.BuildInfo{Version:"v3.13.0", GitCommit:"825e86f6a7a38cef1112bfa606e4127a706749b1", GitTreeState:"clean", GoVersion:"go1.21.1"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions