{{- if and (not .Values.localstack.enabled) (not .Values.externalS3.existingSecret) (not .Values.localstack.existingSecret) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ printf "%s-%s" .Release.Name "externals3"  }}
  namespace: {{ .Release.Namespace | quote }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
    {{- end }}
    app.kubernetes.io/component: backend
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
  {{- end }}
type: Opaque
data:
  endpoint:  {{ .Values.externalS3.endpoint | b64enc | quote }}
  bucketName: {{ .Values.externalS3.bucketName | b64enc | quote }}
  region: {{ .Values.externalS3.region | b64enc | quote }}
  accessKey: {{ .Values.externalS3.accessKey| b64enc | quote }}
  secretKey: {{ .Values.externalS3.secretKey | b64enc | quote }}
{{- end }}
