# Default values for datamate.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

global:
  namespace: datamate
  deerFlow:
    enable: false
  image:
    repository: "ghcr.io/modelengine-group/"
    pullPolicy: "IfNotPresent"
    backend:
      name: "datamate-backend"
      tag: "latest"
    backendPython:
      name: "datamate-backend-python"
      tag: "latest"
    frontend:
      name: "datamate-frontend"
      tag: "latest"
    runtime:
      name: "datamate-runtime"
      tag: "latest"
    database:
      name: "datamate-database"
      tag: "latest"

public:
  persistentVolumeClaim:
    storageClass: ""
    storagePath: ""
    storageNode: ""
    size:
      dataset: 10Gi
      flow: 1Gi
      log: 1Gi
      database: 1Gi
      operator: 1Gi

datasetVolume: &datasetVolume
  name: dataset-volume
  persistentVolumeClaim:
    claimName: datamate-dataset-pvc

flowVolume: &flowVolume
  name: flow-volume
  persistentVolumeClaim:
    claimName: datamate-flow-pvc

logVolume: &logVolume
  name: log-volume
  persistentVolumeClaim:
    claimName: datamate-log-pvc

dataVolume: &dataVolume
  name: data-volume
  persistentVolumeClaim:
    claimName: datamate-database-pvc

operatorVolume: &operatorVolume
  name: operator-volume
  persistentVolumeClaim:
    claimName: datamate-operator-pvc

database:
  env:
    - name: MYSQL_ROOT_PASSWORD
      value: &dbPass "password"
  volumes:
    - *dataVolume
    - *logVolume
  volumeMounts:
    - name: data-volume
      mountPath: /var/lib/mysql
    - name: log-volume
      mountPath: /var/log/datamate/database
      subPath: database

backend:
  env:
    - name: DB_PASSWORD
      value: *dbPass
  volumes:
    - *datasetVolume
    - *flowVolume
    - *logVolume
    - *operatorVolume
  volumeMounts:
    - name: dataset-volume
      mountPath: /dataset
    - name: flow-volume
      mountPath: /flow
    - name: log-volume
      mountPath: /var/log/datamate
    - name: operator-volume
      mountPath: /operators

frontend:
  service:
    type: NodePort
    nodePort: 30000
  volumes:
    - *logVolume
    - name: datamate-nginx-conf
      configMap:
        name: datamate-nginx-conf
  volumeMounts:
    - name: log-volume
      mountPath: /var/log/datamate/frontend
      subPath: frontend
    - mountPath: /etc/nginx/conf.d/backend.conf
      name: datamate-nginx-conf
      subPath: backend.conf

runtime:
  enabled: false
  args: &runtimeArgs
    - python
    - /opt/runtime/datamate/operator_runtime.py
    - --port
    - "8081"
  env: &runtimeEnv
    - name: MYSQL_HOST
      value: "datamate-database"
    - name: MYSQL_PORT
      value: "3306"
    - name: MYSQL_USER
      value: "root"
    - name: MYSQL_PASSWORD
      value: *dbPass
    - name: MYSQL_DATABASE
      value: "datamate"
  volumes:
    - *datasetVolume
    - *flowVolume
    - *logVolume
    - *operatorVolume
  volumeMounts: &runtimeVolumeMounts
    - mountPath: /tmp/ray
      name: log-volume
      subPath: ray/head
    - mountPath: /var/log/datamate
      name: log-volume
    - mountPath: /dataset
      name: dataset-volume
    - mountPath: /flow
      name: flow-volume
    - mountPath: /opt/runtime/datamate/ops/user
      name: operator-volume
      subPath: extract

ray-cluster:
  enabled: true
  head:
    volumes:
      - *datasetVolume
      - *flowVolume
      - *logVolume
      - *operatorVolume
    volumeMounts:
      - mountPath: /tmp/ray
        name: log-volume
        subPath: ray/head
      - mountPath: /dataset
        name: dataset-volume
      - mountPath: /flow
        name: flow-volume
      - mountPath: /opt/runtime/datamate/ops/user
        name: operator-volume
        subPath: extract
    sidecarContainers:
      - name: runtime
        image: datamate-runtime
        imagePullPolicy: IfNotPresent
        args: *runtimeArgs
        env: *runtimeEnv
        ports:
          - containerPort: 8081
        volumeMounts: *runtimeVolumeMounts
  worker:
    volumes:
      - *datasetVolume
      - *flowVolume
      - *logVolume
      - *operatorVolume
    volumeMounts:
      - mountPath: /tmp/ray
        name: log-volume
        subPath: ray/worker
      - mountPath: /dataset
        name: dataset-volume
      - mountPath: /flow
        name: flow-volume
      - mountPath: /opt/runtime/datamate/ops/user
        name: operator-volume
        subPath: extract
