我正在查看相关的HELM代码- https://github.com/kubernetes/ingress-nginx/blob/helm-chart-4.5.2/charts/ingress-nginx/templates/controller-serviceaccount.yaml :
{{- if or .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount metadata: labels: {{- include "ingress-nginx.labels" . | nindent 4 }} app.kubernetes.io/component: controller {{- with .Values.controller.labels }} {{- toYaml . | nindent 4 }} {{- end }} name: {{ template "ingress-nginx.serviceAccountName" . }} namespace: {{ .Release.Namespace }} {{- if .Values.serviceAccount.annotations }} annotations: {{- toYaml .Values.serviceAccount.annotations | nindent 4 }} {{- end }} automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }} {{- end }}
特别是这条线:
name: {{ template "ingress-nginx.serviceAccountName" . }}
我的问题是,如何解决这个问题?
它在中定义 _helpers.tpl 文件:
{{- define "ingress-nginx.serviceAccountName" -}} {{- if .Values.serviceAccount.create -}} {{ default (include "ingress-nginx.fullname" .) .Values.serviceAccount.name }} {{- else -}} {{ default "default" .Values.serviceAccount.name }} {{- end -}} {{- end -}}