apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    service: cube-refresh-worker
  name: cube-refresh-worker
spec:
  replicas: 1
  selector:
    matchLabels:
      service: cube-refresh-worker
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        service: cube-refresh-worker
    spec:
      containers:
        - env: # Refer to https://cube.dev/docs/reference/environment-variables for more options
            - name: CUBEJS_API_SECRET
              value: <API_SECRET>
            - name: CUBEJS_CUBESTORE_HOST
              value: "cubestore-router" # USING THIS CUBESTORE HOST BECAUSE THE CUBESTORE ROUTER SERVICE IS NAMED "CUBESTORE-ROUTER"
            - name: CUBEJS_DB_HOST
              value: <DB_HOST>
            - name: CUBEJS_DB_NAME
              value: <DB_NAME>
            - name: CUBEJS_DB_USER
              value: <DB_USER>
            - name: CUBEJS_DB_PASS
              value: <DB_PASSWORD>
            - name: CUBEJS_DB_TYPE
              value: <DB_TYPE>
            - name: CUBEJS_DEV_MODE
              value: "false" # NEVER RUN DEV MODE IN K8S
            - name: CUBEJS_EXTERNAL_DEFAULT
              value: "true"
            - name: CUBEJS_REDIS_URL
              value: redis://redis:6379 # USING THIS REDIS URL BECAUSE THE REDIS SERVICE IS NAMED "REDIS"
            # SPECIFY THIS INSTANCE TO ACT AS A REFRESH WORKER
            - name: CUBEJS_REFRESH_WORKER
              value: "true"
          image: cubejs/cube:v0.28.14
          name: cube-refresh-worker
          resources: {}
          volumeMounts:
            - mountPath: /cube/conf/schema
              name: cube-api-schema
      restartPolicy: Always
      volumes:
        - name: cube-api-schema
          configMap:
            name: cube-api-schema
status: {}
