Skip to content

Commit 61c0147

Browse files
committed
ddc-skip-default-systeminit
1 parent 6f0c69c commit 61c0147

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

api/disaggregated/v1/types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ type ComputeGroup struct {
9090
UniqueId string `json:"uniqueId"`
9191

9292
CommonSpec `json:",inline"`
93+
94+
// SkipDefaultSystemInit is a switch that skips the default initialization and is used to set the default environment configuration required by the doris BE node.
95+
// Default value is 'false'.
96+
// Default System Init means that the container must be started in privileged mode.
97+
// Default System Init configuration is implemented through the initContainers of the pod, so changes to this configuration may be ignored by k8s when it is not the first deployment.
98+
SkipDefaultSystemInit bool `json:"skipDefaultSystemInit,omitempty"`
9399
}
94100

95101
type CommonSpec struct {

pkg/common/utils/resource/pod.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func NewPodTemplateSpec(dcr *v1.DorisCluster, config map[string]interface{}, com
190190
}
191191

192192
// for disaggregated cluster.
193-
func NewPodTemplateSpecWithCommonSpec(cs *dv1.CommonSpec, componentType dv1.DisaggregatedComponentType) corev1.PodTemplateSpec {
193+
func NewPodTemplateSpecWithCommonSpec(skipInit bool, cs *dv1.CommonSpec, componentType dv1.DisaggregatedComponentType) corev1.PodTemplateSpec {
194194
var vs []corev1.Volume
195195
si := cs.SystemInitialization
196196
var defaultInitContainers []corev1.Container
@@ -214,7 +214,7 @@ func NewPodTemplateSpecWithCommonSpec(cs *dv1.CommonSpec, componentType dv1.Disa
214214
Volumes: vs,
215215
},
216216
}
217-
constructDisaggregatedInitContainers(componentType, &pts.Spec, si)
217+
constructDisaggregatedInitContainers(skipInit, componentType, &pts.Spec, si)
218218
return pts
219219
}
220220

@@ -264,7 +264,7 @@ func constructInitContainers(skipInit bool, componentType v1.ComponentType, podS
264264
podSpec.InitContainers = append(podSpec.InitContainers, defaultInitContains...)
265265
}
266266

267-
func constructDisaggregatedInitContainers(componentType dv1.DisaggregatedComponentType, podSpec *corev1.PodSpec, si *dv1.SystemInitialization) {
267+
func constructDisaggregatedInitContainers(skipInit bool, componentType dv1.DisaggregatedComponentType, podSpec *corev1.PodSpec, si *dv1.SystemInitialization) {
268268
initImage := DEFAULT_INIT_IMAGE
269269
var defaultInitContains []corev1.Container
270270
if si != nil {
@@ -287,7 +287,7 @@ func constructDisaggregatedInitContainers(componentType dv1.DisaggregatedCompone
287287
}
288288

289289
// the init containers have sequence,should confirm use initial is always in the first priority.
290-
if componentType == dv1.DisaggregatedBE {
290+
if !skipInit && componentType == dv1.DisaggregatedBE {
291291
podSpec.InitContainers = append(podSpec.InitContainers, constructBeDefaultInitContainer(initImage))
292292
}
293293
podSpec.InitContainers = append(podSpec.InitContainers, defaultInitContains...)

pkg/common/utils/resource/pod_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func Test_NewPodTemplateSpecWithCommonSpec(t *testing.T) {
122122
tm[dv1.DisaggregatedMS] = mcs
123123

124124
for dct, cs := range tm {
125-
pts := NewPodTemplateSpecWithCommonSpec(cs, dct)
125+
pts := NewPodTemplateSpecWithCommonSpec(false, cs, dct)
126126
t.Log(pts)
127127
}
128128
}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (dcgs *DisaggregatedComputeGroupsController) NewStatefulset(ddc *dv1.DorisD
8181
}
8282

8383
func (dcgs *DisaggregatedComputeGroupsController) NewPodTemplateSpec(ddc *dv1.DorisDisaggregatedCluster, selector map[string]string, cvs map[string]interface{}, cg *dv1.ComputeGroup) corev1.PodTemplateSpec {
84-
pts := resource.NewPodTemplateSpecWithCommonSpec(&cg.CommonSpec, dv1.DisaggregatedBE)
84+
pts := resource.NewPodTemplateSpecWithCommonSpec(cg.SkipDefaultSystemInit, &cg.CommonSpec, dv1.DisaggregatedBE)
8585
//pod template metadata.
8686
func() {
8787
l := (resource.Labels)(selector)
@@ -132,6 +132,12 @@ func (dcgs *DisaggregatedComputeGroupsController) NewCGContainer(ddc *dv1.DorisD
132132
c.Env = append(c.Env, resource.GetPodDefaultEnv()...)
133133
c.Env = append(c.Env, dcgs.newSpecificEnvs(ddc, cg)...)
134134

135+
if cg.SkipDefaultSystemInit {
136+
// Only works when the doris version is higher than 2.1.8 or 3.0.4
137+
// When the environment variable SKIP_CHECK_ULIMIT=true is passed in, the start_be.sh will not check system parameters like ulimit and vm.max_map_count etc.
138+
c.Env = append(c.Env, corev1.EnvVar{Name: "SKIP_CHECK_ULIMIT", Value: "true"})
139+
}
140+
135141
resource.BuildDisaggregatedProbe(&c, &cg.CommonSpec, dv1.DisaggregatedBE)
136142
_, vms, _ := dcgs.BuildVolumesVolumeMountsAndPVCs(cvs, dv1.DisaggregatedBE, &cg.CommonSpec)
137143
_, cmvms := dcgs.BuildDefaultConfigMapVolumesVolumeMounts(cg.ConfigMaps)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (dfc *DisaggregatedFEController) getFEPodLabels(ddc *v1.DorisDisaggregatedC
8686
}
8787

8888
func (dfc *DisaggregatedFEController) NewPodTemplateSpec(ddc *v1.DorisDisaggregatedCluster, confMap map[string]interface{}) corev1.PodTemplateSpec {
89-
pts := resource.NewPodTemplateSpecWithCommonSpec(&ddc.Spec.FeSpec.CommonSpec, v1.DisaggregatedFE)
89+
pts := resource.NewPodTemplateSpecWithCommonSpec(false, &ddc.Spec.FeSpec.CommonSpec, v1.DisaggregatedFE)
9090
//pod template metadata.
9191
labels := dfc.getFEPodLabels(ddc)
9292
pts.Labels = labels

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (dms *DisaggregatedMSController) newStatefulset(ddc *v1.DorisDisaggregatedC
8888
}
8989

9090
func (dms *DisaggregatedMSController) NewPodTemplateSpec(ddc *v1.DorisDisaggregatedCluster, selector map[string]string, confMap map[string]interface{}) corev1.PodTemplateSpec {
91-
pts := resource.NewPodTemplateSpecWithCommonSpec(&ddc.Spec.MetaService.CommonSpec, v1.DisaggregatedMS)
91+
pts := resource.NewPodTemplateSpecWithCommonSpec(false, &ddc.Spec.MetaService.CommonSpec, v1.DisaggregatedMS)
9292
//pod template metadata.
9393
func() {
9494
l := (resource.Labels)(selector)

0 commit comments

Comments
 (0)