{{- if and .Values.agent.enabled .Values.agent.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ default (printf "%s-agent" (include "pulse.fullname" .)) .Values.agent.serviceAccount.name }}
  labels:
    {{- include "pulse.labels" . | nindent 4 }}
  {{- with .Values.agent.serviceAccount.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
{{- end }}
