{{- if and .Values.autoscaler.enabled .Values.rbac.create }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ template "coredns.fullname" . }}-autoscaler
  namespace: {{ .Release.Namespace }}
  labels: {{- include "coredns.labels.autoscaler" . | nindent 4 }}
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels | indent 4 }}
{{- end }}
{{- with .Values.customAnnotations }}
  annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.autoscaler.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.autoscaler.image.pullSecrets }}
  - name: {{ . }}
{{- end }}
{{- end }}
{{- end }}
