{{- if .Values.enableCRDs -}}
{{- if not (.Capabilities.APIVersions.Has "etcd.database.coreos.com/v1beta2") }}
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: etcdclusters.etcd.database.coreos.com
  annotations:
    "helm.sh/resource-policy": keep
    "helm.sh/hook": "crd-install"
spec:
  conversion:
    strategy: None
  group: etcd.database.coreos.com
  names:
    kind: EtcdCluster
    listKind: EtcdClusterList
    plural: etcdclusters
    shortNames:
    - etcd
    singular: etcdcluster
  scope: Namespaced
  version: v1beta2
  versions:
  - name: v1beta2
    served: true
    storage: true
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: etcdbackups.etcd.database.coreos.com
spec:
  conversion:
    strategy: None
  group: etcd.database.coreos.com
  names:
    kind: EtcdBackup
    listKind: EtcdBackupList
    plural: etcdbackups
    singular: etcdbackup
  scope: Namespaced
  version: v1beta2
  versions:
  - name: v1beta2
    served: true
    storage: true
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: etcdrestores.etcd.database.coreos.com
spec:
  conversion:
    strategy: None
  group: etcd.database.coreos.com
  names:
    kind: EtcdRestore
    listKind: EtcdRestoreList
    plural: etcdrestores
    singular: etcdrestore
  scope: Namespaced
  version: v1beta2
  versions:
  - name: v1beta2
    served: true
    storage: true
{{- end }}
{{- end -}}
