kind: ConfigMap
apiVersion: v1
metadata:
  name: {{ include "deepflow.fullname" . }}
  labels:
    {{- include "deepflow.labels" . | nindent 4 }}
data:
  server.yaml: |
    {{- range $elem, $elemVal := index .Values "configmap" "server.yaml" -}}
    {{- if not (kindIs "map" $elemVal) -}}
    {{- if kindIs "invalid" $elemVal -}}
    {{- nindent 4 $elem -}}:
    {{- else if kindIs "string" $elemVal -}}
    {{- if (tpl $elemVal $ ) -}}
    {{- nindent 4 $elem }}: {{ tpl $elemVal $ -}}
    {{- else -}}
    {{- nindent 4 $elem }}:
    {{- end -}}
    {{- else if kindIs "float64" $elemVal -}}
    {{- nindent 4 $elem }}: {{ int $elemVal -}}
    {{- else if kindIs "slice" $elemVal -}}
    {{- nindent 4 $elem -}}: 
    {{- tpl (toYaml $elemVal ) $| nindent 4 -}}
    {{- else -}}
    {{- if $elemVal -}}
    {{- nindent 4 $elem }}: {{ toYaml $elemVal -}}
    {{- else -}}
    {{- nindent 4 $elem }}:
    {{- end -}}
    {{- end -}}
    {{- end -}}
    {{- end -}}
    {{- range $key, $value := index .Values "configmap" "server.yaml" -}}
    {{- if kindIs "map" $value -}}
    {{- nindent 4 $key -}}:
      {{- range $elem, $elemVal := $value -}}
      {{- if not (kindIs "map" $elemVal) -}}
      {{- if kindIs "invalid" $elemVal -}}
      {{- nindent 6 $elem -}}:
      {{- else if kindIs "string" $elemVal -}}
      {{- nindent 6 $elem }}: {{ tpl $elemVal $ -}}
      {{- else if kindIs "float64" $elemVal -}}
      {{- nindent 6 $elem }}: {{ int $elemVal -}}
      {{- else if kindIs "slice" $elemVal -}}
      {{- nindent 6 $elem -}}: 
      {{- tpl (toYaml $elemVal ) $| nindent 6 -}}
      {{- else -}}
      {{- nindent 6 $elem }}: {{  $elemVal -}}
      {{- end -}}
      {{- end -}}
      {{- end -}}
      {{- range $elem, $elemVal := $value -}}
      {{- if kindIs "map" $elemVal -}}
      {{- nindent 6 $elem -}}: 
        {{- range $therrKey, $therrVal := $elemVal -}}
        {{- if not (kindIs "map" $therrVal) -}}
        {{- if kindIs "invalid" $therrVal -}}
        {{- nindent 8 $therrKey -}}:
        {{- else if kindIs "string" $therrVal -}}
        {{- if (tpl $therrVal $ ) -}}
        {{- nindent 8 $therrKey }}: {{ tpl $therrVal $ -}}
        {{- else -}}
        {{- nindent 8 $therrKey }}:
        {{- end -}}
        {{- else if kindIs "float64" $therrVal -}}
        {{- nindent 8 $therrKey }}: {{ int $therrVal -}}
        {{- else if kindIs "slice" $therrVal -}}
        {{- nindent 8 $therrKey -}}: 
        {{- tpl (toYaml $therrVal ) $| nindent 8 -}}
        {{- else -}}
        {{- if $therrVal -}}
        {{- nindent 8 $therrKey }}: {{ toYaml $therrVal -}}
        {{- else -}}
        {{- nindent 8 $therrKey }}:
        {{- end -}}
        {{- end -}}
        {{- end -}}
        {{- end -}}
        {{- range $therrKey, $therrVal := $elemVal -}}
        {{- if kindIs "map" $therrVal -}}
        {{- nindent 8 $therrKey -}}:
          {{- range $fourKey, $fourVal := $therrVal -}}
          {{- if not (kindIs "map" $fourVal) -}}
          {{- if kindIs "invalid" $fourVal -}}
          {{- nindent 10 $fourKey -}}:
          {{- else if kindIs "string" $fourVal -}}
          {{- if (tpl $fourVal $ ) -}}
          {{- nindent 10 $fourKey }}: {{ tpl $fourVal $ -}}
          {{- else -}}
          {{- nindent 10 $fourKey }}:
          {{- end -}}
          {{- else if kindIs "float64" $fourVal -}}
          {{- nindent 10 $fourKey }}: {{ int $fourVal -}}
          {{- else if kindIs "slice" $fourVal -}}
          {{- nindent 10 $fourKey -}}: 
          {{- tpl (toYaml $fourVal ) $| nindent 10 -}}
          {{- else -}}
          {{- if $fourVal -}}
          {{- nindent 10 $fourKey }}: {{ toYaml $fourVal -}}
          {{- else -}}
          {{- nindent 10 $fourKey }}:
          {{- end -}}
          {{- end -}}
          {{- end -}}
          {{- end -}}
          {{- range $fourKey, $fourVal := $therrVal -}}
          {{- if kindIs "map" $fourVal -}}
          {{- nindent 10 $fourKey -}}: 
            {{- range $fiveKey, $fiveVal := $fourVal -}}
            {{- if not (kindIs "map" $fiveVal) -}}
            {{- if kindIs "invalid" $fiveVal -}}
            {{- nindent 12 $fiveKey -}}:
            {{- else if kindIs "string" $fiveVal -}}
            {{- if $fiveVal -}}
            {{- nindent 12 $fiveKey }}: {{ tpl $fiveVal $ -}}
            {{- else -}}
            {{- nindent 12 $fiveKey }}:
            {{- end -}}
            {{- else if kindIs "float64" $fiveVal -}}
            {{- nindent 12 $fiveKey }}: {{ int $fiveVal -}}
            {{- else if kindIs "slice" $fiveVal -}}
            {{- nindent 12 $fiveKey -}}: 
            {{- tpl (toYaml $fiveVal ) $| nindent 12 -}}
            {{- else -}}
            {{- if $fiveVal -}}
            {{- nindent 12 $fiveKey }}: {{  $fiveVal -}}
            {{- else -}}
            {{- nindent 12 $fiveKey }}:
            {{- end -}}
            {{- end -}}
            {{- end -}}
            {{- end -}}
          {{- end -}}
          {{- end -}}
        {{- end -}}
        {{- end -}}
      {{- end -}}
      {{- end -}}
    {{- end -}}
    {{- end }}
  app.yaml: |
    {{- range $elem, $elemVal := index .Values "configmap" "app.yaml" -}}
    {{- if not (kindIs "map" $elemVal) -}}
    {{- if kindIs "invalid" $elemVal -}}
    {{- nindent 4 $elem -}}:
    {{- else if kindIs "string" $elemVal -}}
    {{- if (tpl $elemVal $ ) -}}
    {{- nindent 4 $elem }}: {{ tpl $elemVal $ -}}
    {{- else -}}
    {{- nindent 4 $elem }}:
    {{- end -}}
    {{- else if kindIs "float64" $elemVal -}}
    {{- nindent 4 $elem }}: {{ int $elemVal -}}
    {{- else if kindIs "slice" $elemVal -}}
    {{- nindent 4 $elem -}}: 
    {{- tpl (toYaml $elemVal ) $| nindent 4 -}}
    {{- else -}}
    {{- if $elemVal -}}
    {{- nindent 4 $elem }}: {{ toYaml $elemVal -}}
    {{- else -}}
    {{- nindent 4 $elem }}:
    {{- end -}}
    {{- end -}}
    {{- end -}}
    {{- end -}}
    {{- range $key, $value := index .Values "configmap" "app.yaml" -}}
    {{- if kindIs "map" $value -}}
    {{- nindent 4 $key -}}:
      {{- range $elem, $elemVal := $value -}}
      {{- if not (kindIs "map" $elemVal) -}}
      {{- if kindIs "invalid" $elemVal -}}
      {{- nindent 6 $elem -}}:
      {{- else if kindIs "string" $elemVal -}}
      {{- nindent 6 $elem }}: {{ tpl $elemVal $ -}}
      {{- else if kindIs "float64" $elemVal -}}
      {{- nindent 6 $elem }}: {{ int $elemVal -}}
      {{- else if kindIs "slice" $elemVal -}}
      {{- nindent 6 $elem -}}: 
      {{- tpl (toYaml $elemVal ) $| nindent 6 -}}
      {{- else -}}
      {{- nindent 6 $elem }}: {{  $elemVal -}}
      {{- end -}}
      {{- end -}}
      {{- end -}}
      {{- range $elem, $elemVal := $value -}}
      {{- if kindIs "map" $elemVal -}}
      {{- nindent 6 $elem -}}: 
        {{- range $therrKey, $therrVal := $elemVal -}}
        {{- if not (kindIs "map" $therrVal) -}}
        {{- if kindIs "invalid" $therrVal -}}
        {{- nindent 8 $therrKey -}}:
        {{- else if kindIs "string" $therrVal -}}
        {{- if (tpl $therrVal $ ) -}}
        {{- nindent 8 $therrKey }}: {{ tpl $therrVal $ -}}
        {{- else -}}
        {{- nindent 8 $therrKey }}:
        {{- end -}}
        {{- else if kindIs "float64" $therrVal -}}
        {{- nindent 8 $therrKey }}: {{ int $therrVal -}}
        {{- else if kindIs "slice" $therrVal -}}
        {{- nindent 8 $therrKey -}}: 
        {{- tpl (toYaml $therrVal ) $| nindent 8 -}}
        {{- else -}}
        {{- if $therrVal -}}
        {{- nindent 8 $therrKey }}: {{ toYaml $therrVal -}}
        {{- else -}}
        {{- nindent 8 $therrKey }}:
        {{- end -}}
        {{- end -}}
        {{- end -}}
        {{- end -}}
        {{- range $therrKey, $therrVal := $elemVal -}}
        {{- if kindIs "map" $therrVal -}}
        {{- nindent 8 $therrKey -}}:
          {{- range $fourKey, $fourVal := $therrVal -}}
          {{- if not (kindIs "map" $fourVal) -}}
          {{- if kindIs "invalid" $fourVal -}}
          {{- nindent 10 $fourKey -}}:
          {{- else if kindIs "string" $fourVal -}}
          {{- if (tpl $fourVal $ ) -}}
          {{- nindent 10 $fourKey }}: {{ tpl $fourVal $ -}}
          {{- else -}}
          {{- nindent 10 $fourKey }}:
          {{- end -}}
          {{- else if kindIs "float64" $fourVal -}}
          {{- nindent 10 $fourKey }}: {{ int $fourVal -}}
          {{- else if kindIs "slice" $fourVal -}}
          {{- nindent 10 $fourKey -}}: 
          {{- tpl (toYaml $fourVal ) $| nindent 10 -}}
          {{- else -}}
          {{- if $fourVal -}}
          {{- nindent 10 $fourKey }}: {{ toYaml $fourVal -}}
          {{- else -}}
          {{- nindent 10 $fourKey }}:
          {{- end -}}
          {{- end -}}
          {{- end -}}
          {{- end -}}
          {{- range $fourKey, $fourVal := $therrVal -}}
          {{- if kindIs "map" $fourVal -}}
          {{- nindent 10 $fourKey -}}: 
            {{- range $fiveKey, $fiveVal := $fourVal -}}
            {{- if not (kindIs "map" $fiveVal) -}}
            {{- if kindIs "invalid" $fiveVal -}}
            {{- nindent 12 $fiveKey -}}:
            {{- else if kindIs "string" $fiveVal -}}
            {{- if $fiveVal -}}
            {{- nindent 12 $fiveKey }}: {{ tpl $fiveVal $ -}}
            {{- else -}}
            {{- nindent 12 $fiveKey }}:
            {{- end -}}
            {{- else if kindIs "float64" $fiveVal -}}
            {{- nindent 12 $fiveKey }}: {{ int $fiveVal -}}
            {{- else if kindIs "slice" $fiveVal -}}
            {{- nindent 12 $fiveKey -}}: 
            {{- tpl (toYaml $fiveVal ) $| nindent 12 -}}
            {{- else -}}
            {{- if $fiveVal -}}
            {{- nindent 12 $fiveKey }}: {{  $fiveVal -}}
            {{- else -}}
            {{- nindent 12 $fiveKey }}:
            {{- end -}}
            {{- end -}}
            {{- end -}}
            {{- end -}}
          {{- end -}}
          {{- end -}}
        {{- end -}}
        {{- end -}}
      {{- end -}}
      {{- end -}}
    {{- end -}}
    {{- end }}