starrocks:
  initPassword:
    enabled: true
    # Set a password secret, for example:
    # kubectl create secret generic starrocks-root-pass --from-literal=password='g()()dpa$$word'
    passwordSecret: starrocks-root-pass
  
  metrics:
    serviceMonitor:
      # Whether to expose metrics to Prometheus by ServiceMonitor.
      # Note: make sure the prometheus operator is installed in your cluster.
      # If prometheus is not installed by operator, you can add annotations on k8s service to expose metrics.
      # See https://github.com/StarRocks/starrocks-kubernetes-operator/blob/main/doc/integration/integration-prometheus-grafana.md#51-turn-on-the-prometheus-metrics-scrape-by-adding-annotations for more details.
      enabled: true
  
  # deploy a starrocks cluster
  starrocksCluster:
    # specify the BE/CN deployment or not.
    enabledBe: false
    enabledCn: true
    componentValues:
      image:
        tag: "4.0-latest"
  
  starrocksFESpec:
    replicas: 4
    service:
      type: LoadBalancer
      annotations:
        service.beta.kubernetes.io/azure-load-balancer-internal: "true"
    resources:
      requests:
        cpu: 4
        memory: 8Gi
    storageSpec: 
      name: fe
      storageSize: 10Gi
      storageClassName: starrocks-sc
    # Add FE configuration parameters
    feEnvVars:
      - name: AZURE_ADLS2_PATH
        valueFrom:
          secretKeyRef:
            name: starrocks-adls2-secret
            key: azure_adls2_path
      - name: AZURE_ADLS2_ENDPOINT
        valueFrom:
          secretKeyRef:
            name: starrocks-adls2-secret
            key: azure_adls2_endpoint
      - name: AZURE_ADLS2_SHARED_KEY
        valueFrom:
          secretKeyRef:
            name: starrocks-adls2-secret
            key: azure_adls2_shared_key
    config: |
      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 = DEBUG
      sys_log_delete_age = 4d
      sys_log_roll_num = 5
      # When shutting down FE, it will wait for min_graceful_exit_time_second seconds before refusing new requests. If you
      # want to ensure that queries, writes, and other operations complete smoothly, you need to ensure that the time it
      # takes for the Pod to become Not Ready is less than min_graceful_exit_time_second. The default Pod configuration is
      # probe.FailureThreshold = 3, probe.PeriodSeconds = 5, so in the worst case, the Pod will have (3+1)*5 = 20s to
      # transition to Node Not Ready state. Since the default value of min_graceful_exit_time_second is 15, we change it to a larger value.
      # Note: StarRocks version must be greater than or equal to 3.4.2 to support this configuration, otherwise it will not take effect.
      min_graceful_exit_time_second = 25
      enable_load_profile = true
      load_profile_collect_interval_second = 30
      stream_load_profile_collect_threshold_second = 30
      catalog_trash_expire_second = 2592000
      enable_load_volume_from_conf = true
      enable_collect_query_detail_info = true
      max_stream_load_batch_size_mb = 20480
      run_mode = shared_data
      cloud_native_meta_port = 6090
      cloud_native_storage_type = ADLS2
      azure_adls2_path = ${AZURE_ADLS2_PATH}
      azure_adls2_endpoint = ${AZURE_ADLS2_ENDPOINT}
      azure_adls2_shared_key = ${AZURE_ADLS2_SHARED_KEY}
      
  starrocksBeSpec:
    replicas: 3
    resources:
      requests:
        cpu: 4
        memory: 8Gi
    storageSpec:
      name: be
      storageSize: 15Gi
      storageClassName: starrocks-sc
    # Add BE configuration parameters
    # beEnvVars:
    #   - name: "JAVA_OPTS_FOR_JDK_11"
    #     value: "-Xmx4g -XX:+UseG1GC"
    config: |
      be_port = 9060
      webserver_port = 8040
      heartbeat_service_port = 9050
      brpc_port = 8060
      sys_log_level = INFO
      default_rowset_type = beta
  
  starrocksCnSpec:
    replicas: 5
    resources:
      requests:
        cpu: 8
        memory: 16Gi
      limits:
        cpu: 16
        memory: 32Gi
    storageSpec:
      name: cn
      storageSize: 50Gi
      storageClassName: starrocks-sc
    # Add CN configuration parameters
    # cnEnvVars:
    #   - name: "JAVA_OPTS_FOR_JDK_11"
    #     value: "-Xmx4g -XX:+UseG1GC"
    config: |
      sys_log_level = INFO
      sys_log_roll_num = 5
      # ports for admin, web, heartbeat service
      thrift_port = 9060
      webserver_port = 8040
      heartbeat_service_port = 9050
      brpc_port = 8060
      starlet_port = 9070
      storage_root_path = ${STARROCKS_HOME}/storage
      datacache_disk_size = 10G
      datacache_enable = false
      disable_storage_page_cache = false
      storage_page_cache_limit = 2G
      mem_limit = 80%
    # Optional: Auto-scaling configuration
    autoScalingPolicy:
      maxReplicas: 10 # The maximum number of CNs is set to 10.
      minReplicas: 5 # The minimum number of CNs is set to 5.
      # operator creates an HPA resource based on the following field.
      # see https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ for more information.
      hpaPolicy:
        metrics: # Resource metrics
          # - type: Resource
          #   resource:
          #     name: memory  # The average memory usage of CNs is specified as a resource metric.
          #     target:
          #       # The elastic scaling threshold is 80%.
          #       # When the average memory utilization of CNs exceeds 80%, the number of CNs increases for scale-out.
          #       # When the average memory utilization of CNs is below 80%, the number of CNs decreases for scale-in.
          #       averageUtilization: 80
          #       type: Utilization
          - type: Resource
            resource:
              name: cpu # The average CPU utilization of CNs is specified as a resource metric.
              target:
                # The elastic scaling threshold is 80%.
                # When the average CPU utilization of CNs exceeds 80%, the number of CNs increases for scale-out.
                # When the average CPU utilization of CNs is below 80%, the number of CNs decreases for scale-in.
                averageUtilization: 80
                type: Utilization
        behavior: #  The scaling behavior is customized according to business scenarios, helping you achieve rapid or slow scaling or disable scaling.
          scaleUp:
            policies:
              - type: Pods
                value: 1
                periodSeconds: 10
          scaleDown:
            # Stabilization window: wait 5 minutes (300s) of sustained low utilization before scaling down
            # This prevents flapping due to temporary dips in load
            stabilizationWindowSeconds: 300
            policies:
              # Scale down 1 pod at a time, with a minimum interval of 60 seconds between scale-down events
              # This ensures graceful drainage of queries and connections
              - type: Pods
                value: 1
                periodSeconds: 60
            # selectPolicy options: Min, Max, Disabled
            # Min = conservative (removes fewer pods), Max = aggressive (removes more pods)
            selectPolicy: Min
  
  starrocksFeProxySpec:
    enabled: true
    replicas: 2
    service:
      type: LoadBalancer
      annotations:
        service.beta.kubernetes.io/azure-load-balancer-internal: "true"
    resources:
      requests:
        cpu: 4
        memory: 8Gi
      limits:
        cpu: 8
        memory: 16Gi
 