{{ if and .Values.serviceAccount.create (or .Values.server.kubernetes.enabled .Values.runner.enabled ) -}}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ template "drone.pipelineServiceAccount" . }}
  namespace: {{ default .Release.Namespace .Values.server.kubernetes.namespace }}
  labels:
    app: {{ template "drone.name" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
{{ end }}
