{{- if and .Values.externalWorkloads.enabled .Values.clustermesh.apiserver.tls.auto.enabled (eq .Values.clustermesh.apiserver.tls.auto.method "certmanager") }}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: clustermesh-apiserver-client-cert
  namespace: {{ .Release.Namespace }}
spec:
  issuerRef:
    {{- include "clustermesh-apiserver-generate-certs.certmanager.issuer" . | nindent 4 }}
  secretName: clustermesh-apiserver-client-cert
  commonName: externalworkload
  duration: {{ printf "%dh" (mul .Values.clustermesh.apiserver.tls.auto.certValidityDuration 24) }}
{{- end }}
