Skip to content

Commit 1f33fdb

Browse files
committed
ddc_work_load_group
1 parent 6f0c69c commit 1f33fdb

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

api/disaggregated/v1/types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ type ComputeGroup struct {
8989
//the unique identifier of compute group, first register in fe will use UniqueId as cluster name.
9090
UniqueId string `json:"uniqueId"`
9191

92+
// EnableWorkloadGroup is a switch that determines whether the doris cluster enables the workload group.
93+
// Default value is 'false'.
94+
// Enabling it means that the container must be started in privileged mode.
95+
// Please confirm whether the host machine and k8s cluster allow it.
96+
// Doris workloadgroup reference document: https://doris.apache.org/docs/admin-manual/resource-admin/workload-group
97+
EnableWorkloadGroup bool `json:"enableWorkloadGroup,omitempty"`
98+
9299
CommonSpec `json:",inline"`
93100
}
94101

pkg/controller/sub_controller/disaggregated_cluster/computegroups/statefulset.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
package computegroups
1919

2020
import (
21+
"fmt"
2122
dv1 "github.com/apache/doris-operator/api/disaggregated/v1"
2223
"github.com/apache/doris-operator/pkg/common/utils/resource"
2324
sub "github.com/apache/doris-operator/pkg/controller/sub_controller"
2425
appv1 "k8s.io/api/apps/v1"
2526
corev1 "k8s.io/api/core/v1"
2627
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
28+
"k8s.io/utils/pointer"
2729
"strconv"
2830
)
2931

@@ -120,6 +122,14 @@ func (dcgs *DisaggregatedComputeGroupsController) NewPodTemplateSpec(ddc *dv1.Do
120122
}
121123

122124
func (dcgs *DisaggregatedComputeGroupsController) NewCGContainer(ddc *dv1.DorisDisaggregatedCluster, cvs map[string]interface{}, cg *dv1.ComputeGroup) corev1.Container {
125+
126+
if cg.EnableWorkloadGroup {
127+
if cg.ContainerSecurityContext == nil {
128+
cg.ContainerSecurityContext = &corev1.SecurityContext{}
129+
}
130+
cg.ContainerSecurityContext.Privileged = pointer.Bool(true)
131+
}
132+
123133
c := resource.NewContainerWithCommonSpec(&cg.CommonSpec)
124134
c.Lifecycle = resource.LifeCycleWithPreStopScript(c.Lifecycle, sub.GetDisaggregatedPreStopScript(dv1.DisaggregatedBE))
125135
cmd, args := sub.GetDisaggregatedCommand(dv1.DisaggregatedBE)
@@ -183,5 +193,11 @@ func (dcgs *DisaggregatedComputeGroupsController) newSpecificEnvs(ddc *dv1.Doris
183193
)
184194
}
185195

196+
if cg.EnableWorkloadGroup {
197+
cgEnvs = append(cgEnvs,
198+
corev1.EnvVar{Name: resource.ENABLE_WORKLOAD_GROUP, Value: fmt.Sprintf("%t", cg.EnableWorkloadGroup)},
199+
)
200+
}
201+
186202
return cgEnvs
187203
}

0 commit comments

Comments
 (0)