# helm_charts_deployment-coordinator.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ template "presto.coordinator" . }}
  labels:
    app: {{ template "presto.name" . }}
    chart: {{ template "presto.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
    component: coordinator
spec:
  selector:
    matchLabels:
      app: {{ template "presto.name" . }}
      release: {{ .Release.Name }}
      component: coordinator
  template:
    metadata:
      labels:
        app: {{ template "presto.name" . }}
        release: {{ .Release.Name }}
        component: coordinator
    spec:
      {{- with .Values.image.securityContext }}
      securityContext:
        runAsUser: {{ .runAsUser }}
        runAsGroup: {{ .runAsGroup }}
      {{- end }}
      volumes:
        - name: config-volume
          configMap:
            name: {{ template "presto.coordinator" . }}
      containers:
        - name: {{ .Chart.Name }}-coordinator
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          volumeMounts:
            - mountPath: {{ .Values.server.config.path }}
              name: config-volume
          ports:
            - name: http-coord
              containerPort: {{ .Values.server.config.http.port }}
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /v1/cluster
              port: http-coord
          readinessProbe:
            httpGet:
              path: /v1/cluster
              port: http-coord
          resources:
{{ toYaml .Values.resources | indent 12 }}
    {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}