{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}

{{- if .Values.taskmanager.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
  name:  {{ include "flink.taskmanager.serviceAccountName" . }}
  namespace: {{ include "common.names.namespace" . | quote }}
  labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
    app.kubernetes.io/part-of: flink
    app.kubernetes.io/component: taskmanager
  {{- $mergedAnnotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.taskmanager.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }}
  {{- if $mergedAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" $mergedAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
automountServiceAccountToken: {{ .Values.taskmanager.serviceAccount.automountServiceAccountToken }}
{{- end }}
