{{- if .Values.customResources.createEtcdClusterCRD }}
---
apiVersion: "etcd.database.coreos.com/v1beta2"
kind: "EtcdCluster"
metadata:
  name: {{ .Values.etcdCluster.name }}
  labels:
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    app: {{ template "etcd-operator.name" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
  annotations:
    "helm.sh/hook": "post-install"
    "helm.sh/hook-delete-policy": "before-hook-creation"
spec:
  size: {{ .Values.etcdCluster.size }}
  version: "{{ .Values.etcdCluster.version }}"
  pod:
{{ toYaml .Values.etcdCluster.pod | indent 4 }}
  {{- if .Values.etcdCluster.enableTLS }}
  TLS:
{{ toYaml .Values.etcdCluster.tls | indent 4 }}
  {{- end }}
{{- end }}

