# helm_charts_configmap-coordinator.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "presto.coordinator" . }}
  labels:
    app: {{ template "presto.name" . }}
    chart: {{ template "presto.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
    component: coordinator
data:
  node.properties: |
    node.environment={{ .Values.server.node.environment }}
    node.data-dir={{ .Values.server.node.dataDir }}
    plugin.dir={{ .Values.server.node.pluginDir }}

  jvm.config: |
    -server
    -Xmx{{ .Values.server.jvm.maxHeapSize }}
    -XX:+{{ .Values.server.jvm.gcMethod.type }}
    -XX:G1HeapRegionSize={{ .Values.server.jvm.gcMethod.g1.heapRegionSize }}
    -XX:+UseGCOverheadLimit
    -XX:+ExplicitGCInvokesConcurrent
    -XX:+HeapDumpOnOutOfMemoryError
    -XX:+ExitOnOutOfMemoryError
    -Djdk.attach.allowAttachSelf=true

  config.properties: |
    coordinator=true
{{- if gt (int .Values.server.workers) 0 }}
    node-scheduler.include-coordinator=false
{{- else }}
    node-scheduler.include-coordinator=true
{{- end }}
    http-server.http.port={{ .Values.server.config.http.port }}
    query.max-memory={{ .Values.server.config.query.maxMemory }}
    query.max-memory-per-node={{ .Values.server.config.query.maxMemoryPerNode }}
    discovery-server.enabled=true
    discovery.uri=http://localhost:{{ .Values.server.config.http.port }}

  log.properties: |
    io.prestosql={{ .Values.server.log.presto.level }}

---