apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: {{ .Release.Name }}-etcd-operator
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ template "vault-operator.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
    name: etcd-operator
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: {{ template "vault-operator.name" . }}
        release: {{ .Release.Name }}
        name: etcd-operator
    spec:
      serviceAccountName: {{ template "vault-operator.sa" . }}
      containers:
        - name: etcd-operator
          image: "{{ .Values.etcd.image.repository }}:{{ .Values.etcd.image.tag }}"
          imagePullPolicy: {{ .Values.imagePullPolicy }}
          command:
          - etcd-operator
          - "--create-crd=false"
          env:
          - name: MY_POD_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: MY_POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          resources:
{{ toYaml .Values.resources | indent 12 }}
    {{- if .Values.nodeSelector }}
      nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
    {{- end }}
