{{- if and .Values.globalConnectionSecret.publicApiKey .Values.globalConnectionSecret.clientSecret }} {{- fail "globalConnectionSecret: set either (publicApiKey,privateApiKey) or (clientId,clientSecret), not both" }} {{- end }} {{- if or .Values.globalConnectionSecret.publicApiKey .Values.globalConnectionSecret.clientSecret }} apiVersion: v1 kind: Secret type: Opaque metadata: name: "{{ include "mongodb-atlas-operator.name" . }}-api-key" labels: atlas.mongodb.com/type: "credentials" {{- include "mongodb-atlas-operator.labels" . | nindent 4 }} data: orgId: {{ .Values.globalConnectionSecret.orgId | b64enc }} {{- if .Values.globalConnectionSecret.publicApiKey }} publicApiKey: {{ .Values.globalConnectionSecret.publicApiKey | b64enc }} privateApiKey: {{ .Values.globalConnectionSecret.privateApiKey | b64enc }} {{- else }} clientId: {{ .Values.globalConnectionSecret.clientId | b64enc }} clientSecret: {{ .Values.globalConnectionSecret.clientSecret | b64enc }} {{- end }} {{- end }}