apiVersion: v1
kind: ConfigMap
metadata:
  name: turbo-config-{{ .Release.Name }}
data:
  turbo.config: |-
    {
      "communicationConfig": {
        "serverMeta": {
        {{- if .Values.serverMeta.proxy }}
          "proxy": "{{ .Values.serverMeta.proxy }}",
        {{- end }}
          "version": "{{ .Values.serverMeta.version }}",
          "turboServer": "{{ .Values.serverMeta.turboServer }}"
        },
        "restAPIConfig": {
          "opsManagerUserName": "{{ .Values.restAPIConfig.opsManagerUserName }}",
          "opsManagerPassword": "{{ .Values.restAPIConfig.opsManagerPassword }}"
        }
      },
      "HANodeConfig": {
        "nodeRoles": [{{ .Values.HANodeConfig.nodeRoles }}]
      {{- if .Values.targetConfig }}
        {{- if .Values.targetConfig.targetName }}
      },
      "targetConfig": {
        "targetName": "{{ .Values.targetConfig.targetName }}"
        {{- end }}
      {{- end }}
      {{- if .Values.daemonPodDetectors }}
      },
      "daemonPodDetectors": {
        "namespaces": ["{{ .Values.daemonPodDetectors.daemonPodNamespaces1 }}", "{{ .Values.daemonPodDetectors.daemonPodNamespaces2 }}"],
        "podNamePatterns": ["{{ .Values.daemonPodDetectors.daemonPodNamePatterns }}"]
      {{- end }}
      }
    }