This is an automated email from the ASF dual-hosted git repository.

smiletan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 9505da1969c [feature](k8s) add ddc workload group support for 
doris-operator (#50247)
9505da1969c is described below

commit 9505da1969c651452aa149f9b977bd1c40bc1cbe
Author: catpineapple <[email protected]>
AuthorDate: Thu Apr 24 10:48:08 2025 +0800

    [feature](k8s) add ddc workload group support for doris-operator (#50247)
    
    ### What problem does this PR solve?
    
    add DDC workload group support for doris-operator , doris be image, the
    built-in script has important logic in this PR.
    
    Related PR: doris-operator:
    [378](https://github.com/apache/doris-operator/pull/378)
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 .../be/resource/be_disaggregated_entrypoint.sh     | 37 ++++++++++++++++++++++
 docker/runtime/be/resource/be_entrypoint.sh        |  8 ++---
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/docker/runtime/be/resource/be_disaggregated_entrypoint.sh 
b/docker/runtime/be/resource/be_disaggregated_entrypoint.sh
index 9f0110dcac5..6505f196b00 100755
--- a/docker/runtime/be/resource/be_disaggregated_entrypoint.sh
+++ b/docker/runtime/be/resource/be_disaggregated_entrypoint.sh
@@ -43,11 +43,21 @@ DB_ADMIN_PASSWD=$PASSWD
 
 COMPUTE_GROUP_NAME=${COMPUTE_GROUP_NAME}
 
+ENABLE_WORKLOAD_GROUP=${ENABLE_WORKLOAD_GROUP:-false}
+WORKLOAD_GROUP_PATH="/sys/fs/cgroup/cpu/doris"
+
 log_stderr()
 {
     echo "[`date`] $@" >&2
 }
 
+function add_workloadgroup_config()
+{
+    if [[ "x$ENABLE_WORKLOAD_GROUP" == "xtrue" ]]; then
+          echo "doris_cgroup_cpu_path=$WORKLOAD_GROUP_PATH" >> 
${DORIS_HOME}/conf/be.conf
+    fi
+}
+
 update_conf_from_configmap()
 {
     echo "deploy_mode = cloud" >> $DORIS_HOME/conf/be.conf
@@ -240,6 +250,26 @@ function check_and_register()
     fi
 }
 
+
+function make_dir_for_workloadgroup() {
+    output=$(cat /proc/filesystems | grep cgroup)
+    if [ -z "$output" ]; then
+        log_stderr "[error] The host machine does not have cgroup installed, 
so the workload group function will be limited."
+        exit 1
+    fi
+
+    mkdir -p /sys/fs/cgroup/cpu/doris
+    chmod 770 /sys/fs/cgroup/cpu/doris
+    chown -R root:root /sys/fs/cgroup/cpu/doris
+
+    if [[ -f "/sys/fs/cgroup/cgroup.controllers" ]]; then
+        log_stderr "[info] The host machine cgroup version: v2."
+        chmod a+w /sys/fs/cgroup/cgroup.procs
+    else
+        log_stderr "[info] The host machine cgroup version: v1."
+    fi
+}
+
 fe_addrs=$1
 if [[ "x$fe_addrs" == "x" ]]; then
     echo "need fe address as paramter!"
@@ -247,6 +277,12 @@ if [[ "x$fe_addrs" == "x" ]]; then
     exit 1
 fi
 
+if [[ "x$ENABLE_WORKLOAD_GROUP" == "xtrue" ]]; then
+      log_stderr '[info] Enable workload group !'
+      make_dir_for_workloadgroup
+fi
+
+
 # pre check for starting
 if cat /proc/cpuinfo | grep -q "avx2" &>/dev/null; then
     log_stderr "[info] the host machine support avx2 instruction set."
@@ -255,6 +291,7 @@ else
 fi
 
 update_conf_from_configmap
+add_workloadgroup_config
 # resolve password for root to manage nodes in doris.
 resolve_password_from_secret
 collect_env_info
diff --git a/docker/runtime/be/resource/be_entrypoint.sh 
b/docker/runtime/be/resource/be_entrypoint.sh
index 8848f1e4841..8fd1ffae073 100755
--- a/docker/runtime/be/resource/be_entrypoint.sh
+++ b/docker/runtime/be/resource/be_entrypoint.sh
@@ -49,7 +49,7 @@ log_stderr()
     echo "[`date`] $@" >&2
 }
 
-function add_default_conf()
+function add_workloadgroup_config()
 {
     if [[ "x$ENABLE_WORKLOAD_GROUP" == "xtrue" ]]; then
           echo "doris_cgroup_cpu_path=$WORKLOAD_GROUP_PATH" >> 
${DORIS_HOME}/conf/be.conf
@@ -282,7 +282,7 @@ function check_and_register()
     fi
 }
 
-function work_load_group_for_cgroup_path() {
+function make_dir_for_workloadgroup() {
     output=$(cat /proc/filesystems | grep cgroup)
     if [ -z "$output" ]; then
         log_stderr "[error] The host machine does not have cgroup installed, 
so the workload group function will be limited."
@@ -310,7 +310,7 @@ fi
 
 if [[ "x$ENABLE_WORKLOAD_GROUP" == "xtrue" ]]; then
       log_stderr '[info] Enable workload group !'
-      work_load_group_for_cgroup_path
+      make_dir_for_workloadgroup
 fi
 
 
@@ -322,7 +322,7 @@ else
 fi
 
 update_conf_from_configmap
-add_default_conf
+add_workloadgroup_config
 mount_kerberos_config
 # resolve password for root to manage nodes in doris.
 resolve_password_from_secret


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to