# grafana_charts_operator-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "ga-operator.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
{{ include "ga-operator.labels" . | indent 4 }}
  {{- with .Values.annotations }}
  annotations:
  {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  replicas: 1
  selector:
    matchLabels:
{{ include "ga-operator.selectorLabels" . | indent 6 }}
  template:
    metadata:
      labels:
{{ include "ga-operator.selectorLabels" . | indent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}
      annotations:
{{ toYaml . | indent 8 }}
{{- end }}
    spec:
      {{- with .Values.priorityClassName }}
      priorityClassName: {{ . }}
      {{- end }}
      serviceAccountName: {{ template "ga-operator.serviceAccountName" . }}
      {{- with .Values.podSecurityContext }}
      securityContext:
      {{- toYaml . | nindent 8 }}
      {{- end }}
      containers:
      - name: {{ include "ga-operator.name" . }}
        image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
        imagePullPolicy: {{ .Values.image.pullPolicy }}
        {{- with .Values.containerSecurityContext }}
        securityContext:
        {{- toYaml . | nindent 10 }}
        {{- end }}
        {{- with .Values.resources }}
        resources:
        {{- toYaml . | nindent 10 }}
        {{- end }}
        {{- if or (and .Values.kubeletService.namespace .Values.kubeletService.serviceName) (.Values.extraArgs) }}
        args:
          {{- if and .Values.kubeletService.namespace .Values.kubeletService.serviceName }}
          - --kubelet-service={{ .Values.kubeletService.namespace }}/{{ .Values.kubeletService.serviceName }}
          {{- end }}
          {{- if .Values.extraArgs  }}
          {{- range .Values.extraArgs  }}
          - {{ . }}
          {{- end }}
          {{- end }}
        {{- end }}
      {{- with .Values.image.pullSecrets }}
      imagePullSecrets:
      {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.hostAliases }}
      hostAliases:
      {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
      {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
      {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
      {{- toYaml . | nindent 8 }}
      {{- end }}