{{- if and .Values.clustermesh.useAPIServer .Values.clustermesh.config.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
  name: cilium-clustermesh
  namespace: {{ .Release.Namespace }}
data:
  {{- range .Values.clustermesh.config.clusters }}
  {{ .name }}: {{ include "clustermesh-config-generate-etcd-cfg" (list . $.Values.clustermesh.config.domain) | b64enc }}
  {{ .name }}.etcd-client-ca.crt: {{ $.Values.clustermesh.apiserver.tls.ca.cert }}
  {{ .name }}.etcd-client.key: {{ .tls.key }}
  {{ .name }}.etcd-client.crt: {{ .tls.cert }}
  {{- end }}
{{- end }}