{{ if .Values.halyard.serviceConfigs -}}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "spinnaker.fullname" . }}-service-configs
  labels:
{{ include "spinnaker.standard-labels" . | indent 4 }}

{{/*
Render local configuration for each service with values passed by
.Values.halyard.serviceConfigs
*/}}
{{- $settings := dict -}}

{{- if .Values.halyard.serviceConfigs -}}
{{- $_ := mergeOverwrite $settings .Values.halyard.serviceConfigs -}}
{{- end -}}

{{- /* Convert the content of settings key to YAML string */}}
{{- range $filename, $content := $settings -}}
{{- if not (typeIs "string" $content) -}}
{{- $_ := set $settings $filename ($content | toYaml) -}}
{{- end -}}
{{- end -}}

data:
{{ $settings | toYaml | indent 2 }}
{{- end -}}
