{{- if .Values.certificates.certManager.enabled -}} {{- $certmanagerVer := split "." .Values.certificates.certManager.version -}} {{- if or (.Capabilities.APIVersions.Has "cert-manager.io/v1") (and (gt (len $certmanagerVer._0) 0) (eq (int $certmanagerVer._0) 1) (ge (int $certmanagerVer._1) 0)) }} apiVersion: cert-manager.io/v1 {{- else if or (.Capabilities.APIVersions.Has "cert-manager.io/v1beta1") (and (gt (len $certmanagerVer._0) 0) (eq (int $certmanagerVer._0) 0) (ge (int $certmanagerVer._1) 16)) }} apiVersion: cert-manager.io/v1beta1 {{- else if or (.Capabilities.APIVersions.Has "cert-manager.io/v1alpha2") (and (gt (len $certmanagerVer._0) 0) (eq (int $certmanagerVer._0) 0) (ge (int $certmanagerVer._1) 11)) }} apiVersion: cert-manager.io/v1alpha2 {{- else if or (.Capabilities.APIVersions.Has "certmanager.k8s.io/v1alpha1") (and (gt (len $certmanagerVer._0) 0) (eq (int $certmanagerVer._0) 0) (lt (int $certmanagerVer._1) 11)) }} apiVersion: certmanager.k8s.io/v1alpha1 {{- else }} # Setting latest version as default apiVersion: cert-manager.io/v1 {{- end }} kind: Certificate metadata: labels: {{ include "externalip-webhook.labels" . | indent 4 }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} name: {{ template "externalip-webhook.fullname" . }}-server-cert namespace: {{ .Release.Namespace }} spec: dnsNames: - {{ template "externalip-webhook.fullname" . }}.{{ .Release.Namespace }}.svc - {{ template "externalip-webhook.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local issuerRef: kind: Issuer name: {{ template "externalip-webhook.fullname" . }}-issuer secretName: {{ .Values.certificates.secretName }} --- {{- if or (.Capabilities.APIVersions.Has "cert-manager.io/v1") (and (gt (len $certmanagerVer._0) 0) (eq (int $certmanagerVer._0) 1) (ge (int $certmanagerVer._1) 0)) }} apiVersion: cert-manager.io/v1 {{- else if or (.Capabilities.APIVersions.Has "cert-manager.io/v1beta1") (and (gt (len $certmanagerVer._0) 0) (eq (int $certmanagerVer._0) 0) (ge (int $certmanagerVer._1) 16)) }} apiVersion: cert-manager.io/v1beta1 {{- else if or (.Capabilities.APIVersions.Has "cert-manager.io/v1alpha2") (and (gt (len $certmanagerVer._0) 0) (eq (int $certmanagerVer._0) 0) (ge (int $certmanagerVer._1) 11)) }} apiVersion: cert-manager.io/v1alpha2 {{- else if or (.Capabilities.APIVersions.Has "certmanager.k8s.io/v1alpha1") (and (gt (len $certmanagerVer._0) 0) (eq (int $certmanagerVer._0) 0) (lt (int $certmanagerVer._1) 11)) }} apiVersion: certmanager.k8s.io/v1alpha1 {{- else }} # Setting latest version as default apiVersion: cert-manager.io/v1 {{- end }} kind: Issuer metadata: labels: {{ include "externalip-webhook.labels" . | indent 4 }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} name: {{ template "externalip-webhook.fullname" . }}-issuer namespace: {{ .Release.Namespace }} spec: selfSigned: {} {{- end -}}