{{- if .Values.ingress.tls -}}
{{- $values := .Values }}
{{- range .Values.ingress.tls -}}
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
  name: {{ include "app.fullname" $ }}
  {{- if hasKey $values "namespace" }}
  namespace: {{ $values.namespace }}
  {{- end }}
  labels:
    helm.sh/chart: {{ include "app.chart" $ }}
    app.kubernetes.io/name: {{ include "app.name" $ }}
    app.kubernetes.io/instance: {{ $.Release.Name }}
    app.kubernetes.io/managed-by: {{ $.Release.Service }}
spec:
  secretName: {{ .secretName }}
  {{- with .hosts }}
  dnsNames:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  issuerRef:
    name: {{ $values.ingress.issuerName }}
    kind: {{ $values.ingress.issuerKind }}
  # DCOS-60297 Update certificate to comply with Apple security requirements
  # https://support.apple.com/en-us/HT210176
  usages:
  - digital signature
  - key encipherment
  - server auth
  - code signing
---
{{- end }}
{{- end }}

{{- if .Values.ingress.tls -}}
{{- $values := .Values }}
{{- range .Values.ingress.tls -}}
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
  name: {{ include "app.fullname" $ }}
  {{- if hasKey $values "namespace" }}
  namespace: {{ $values.namespace }}
  {{- end }}
  labels:
    helm.sh/chart: {{ include "app.chart" $ }}
    app.kubernetes.io/name: {{ include "app.name" $ }}
    app.kubernetes.io/instance: {{ $.Release.Name }}
    app.kubernetes.io/managed-by: {{ $.Release.Service }}
spec:
  secretName: {{ .secretName }}
  {{- with .hosts }}
  dnsNames:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  {{- if $values.issuer.selfSigned }}
    # @TODO: how to do if not ?
  {{- else }}
  acme:
    config:
    - http01:
        ingressClass: {{ $values.ingress.class }}
      {{- with .hosts }}
      domains:
        {{- toYaml . | nindent 8 }}
      {{- end }}
  {{- end }}
  issuerRef:
    name: {{ $values.ingress.issuerName }}
    kind: {{ $values.ingress.issuerKind }}
  # DCOS-60297 Update certificate to comply with Apple security requirements
  # https://support.apple.com/en-us/HT210176
  usages:
  - digital signature
  - key encipherment
  - server auth
  - code signing
---
{{- end }}
{{- end }}

Add acme settings when not using self-signed cert
Add acme settings when not using self-signed cert
