{{- if .Values.clusterConfig.acme.dns01 }}
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-prod-dns01
spec:
  acme:
    email: {{ .Values.clusterConfig.acme.email }}
    server: https://acme-v02.api.letsencrypt.org/directory
    privateKeySecretRef:
      name: letsencrypt-prod
    solvers:
    - dns01:
        webhook:
          groupName: acme.obx.io
          solverName: namecheap
          config:
            apiKeySecretRef:
              name: {{ .Values.clusterConfig.acme.dns01 }}
              key: apiKey
            apiUserSecretRef:
              name: {{ .Values.clusterConfig.acme.dns01 }}
              key: apiUser
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-stg-dns01
spec:
  acme:
    email: {{ .Values.clusterConfig.acme.email }}
    server: https://acme-staging-v02.api.letsencrypt.org/directory
    privateKeySecretRef:
      name: letsencrypt-stg
    solvers:
    - dns01:
        webhook:
          groupName: acme.obx.io
          solverName: namecheap
          config:
            apiKeySecretRef:
              name: {{ .Values.clusterConfig.acme.dns01 }}
              key: apiKey
            apiUserSecretRef:
              name: {{ .Values.clusterConfig.acme.dns01 }}
              key: apiUser
{{- end }}
