{{- if .Values.trembita -}}
kind: ConfigMap
apiVersion: v1
metadata:
  name: {{ .Values.registryConfigs.trembitaRegistriesConfigurationName }}
data:
  trembita-registries-configuration.yml: |
    trembita:
      registries:
        {{- range $k,$v := .Values.trembita.registries }}
        {{ $k }}:
          {{- range $kIn,$vIn := $v }}
        {{- if ne $kIn "type" }}
            {{- if eq $kIn "auth" }}
          {{ $kIn }}:
            {{- range $kInIn,$vInIn := $vIn }}
              {{- if ne $kInIn "secret" }}
            {{ $kInIn }}: {{ $vInIn | quote }}
            {{- end -}}
            {{- end -}}
            {{- end -}}
            {{- if or (eq $kIn "client") (eq $kIn "service") }}
            {{- if $vIn }}
          {{ $kIn }}:
            {{- range $kInInCS,$vInInCS := $vIn }}
            {{ $kInInCS }}: {{ $vInInCS | quote }}
            {{- end -}}
            {{- end -}}
                {{- else }}
            {{- if ne $kIn "auth" }}
          {{ $kIn }}: {{ $vIn | quote }}
            {{- end -}}
            {{- end -}}
        {{- end -}}
        {{- end -}}
        {{- end -}}
    {{- end -}}
