apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: {{ .Chart.Name }}
    app.kubernetes.io/version: {{ .Chart.Version }}
  name: {{ .Release.Name }}
spec:
  replicas: {{ .Values.replicas }}
  selector:
    matchLabels:
      app: elemental-operator
  template:
    metadata:
      labels:
        app: elemental-operator
    spec:
      containers:
      - env:
        - name: NO_PROXY
          value: {{ .Values.noProxy }}
        {{- if .Values.proxy }}
        - name: HTTP_PROXY
          value: {{ .Values.proxy }}
        - name: HTTPS_PROXY
          value: {{ .Values.proxy }}
        {{- end }}
        name: {{ .Release.Name }}
        imagePullPolicy: "{{ .Values.image.imagePullPolicy }}"
        image: {{ template "registry_url" . }}{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}
        args:
        - operator
        {{- if .Values.debug }}
        - --v=5
        - --debug
        {{- end }}
        - --namespace
        - {{ .Release.Namespace }}
        - --operator-image
        - {{ template "registry_url" . }}{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}
        - --seedimage-image
        - {{ template "registry_url" . }}{{ .Values.seedImage.repository }}:{{ .Values.seedImage.tag | default .Chart.AppVersion }}
        - --seedimage-image-pullpolicy
        - {{ .Values.seedImage.imagePullPolicy}}
      serviceAccountName: {{ .Release.Name }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
