apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "ark.fullname" . }}
  labels:
    chart: {{ template "ark.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
    app: {{ template "ark.name" . }}
data:
  ark-config.yaml: |
    apiVersion: ark.heptio.com/v1
    kind: Config
    metadata:
      name: default
{{ with .Values.configuration }}
  {{- with .persistentVolumeProvider }}
    persistentVolumeProvider:
      name: {{ .name  }}
    {{ with .config }}
      config:
      {{- with .region }}
        region: {{ . }}
      {{- end }}
      {{- with .apitimeout }}
        apiTimeout: {{ . }}
      {{- end }}
    {{- end }}
  {{- end }}
  {{- with .backupStorageProvider }}
    backupStorageProvider:
      name: {{ .name }}
      bucket: {{ .bucket  }}
    {{- with .config }}
      config:
      {{- with .region }}
        region: {{ . }}
      {{- end }}
      {{- with .s3ForcePathStyle }}
        s3ForcePathStyle: {{ . }}
      {{- end }}
      {{- with .s3Url }}
        s3Url: {{ . }}
      {{- end }}
      {{- with .kmsKeyId }}
        kmsKeyId: {{ . }}
      {{- end }}
    {{- end }}
  {{- end }}
    backupSyncPeriod: {{ .backupSyncPeriod }}
    gcSyncPeriod: {{ .gcSyncPeriod }}
    scheduleSyncPeriod: {{ .scheduleSyncPeriod }}
    restoreOnlyMode: {{ .restoreOnlyMode }}
{{- end }}
