# This manifest deploys a PhoenixAI cluster with FE, CN, and mount their own config
# By default, the PhoenixAI cluster will use the default configuration file.
# This configuration might not be apt for your specific environment; for instance, the
# default -Xmx8192m setting for FE could potentially lead to JVM Out Of Memory issues.
# FE default config: https://github.com/StarRocks/starrocks/blob/main/conf/fe.conf
# CN default config: https://github.com/StarRocks/starrocks/blob/main/conf/cn.conf

apiVersion: phoenixdata.ai/v1
kind: PhoenixAICluster
metadata:
  name: a-phoenixai-with-custom-config   # change the name if needed.
spec:
  phoenixAIFeSpec:
    image: us-west1-docker.pkg.dev/phoenix-ai-images/enterprise/fe-ubuntu:4.1.5-ee
    replicas: 3
    limits:
      cpu: 8
      memory: 16Gi
    requests:
      cpu: 8
      memory: 16Gi
    configMapInfo:
      configMapName: phoenixaicluster-sample-fe-cm
      resolveKey: fe.conf
  phoenixAICnSpec:
    image: us-west1-docker.pkg.dev/phoenix-ai-images/enterprise/cn-ubuntu:4.1.5-ee
    replicas: 1
    limits:
      cpu: 16
      memory: 64Gi
    requests:
      cpu: 16
      memory: 64Gi
    configMapInfo:
      configMapName: phoenixaicluster-sample-cn-cm
      resolveKey: cn.conf

---

# fe config
apiVersion: v1
kind: ConfigMap
metadata:
  name: phoenixaicluster-sample-fe-cm
  labels:
    cluster: phoenixaicluster-sample
data:
  fe.conf: |
    LOG_DIR = ${STARROCKS_HOME}/log
    DATE = "$(date +%Y%m%d-%H%M%S)"
    JAVA_OPTS="-Dlog4j2.formatMsgNoLookups=true -Xmx8192m -XX:+UseG1GC -Xlog:gc*:${LOG_DIR}/fe.gc.log.$DATE:time"
    http_port = 8030
    rpc_port = 9020
    query_port = 9030
    edit_log_port = 9010
    mysql_service_nio_enabled = true
    sys_log_level = INFO

---

# cn config
apiVersion: v1
kind: ConfigMap
metadata:
  name: phoenixaicluster-sample-cn-cm
  labels:
    cluster: phoenixaicluster-sample
data:
  cn.conf: |
    sys_log_level = INFO
    # ports for admin, web, heartbeat service
    thrift_port = 9060
    webserver_port = 8040
    heartbeat_service_port = 9050
    brpc_port = 8060
