Skip to content

Commit 2d5ced9

Browse files
author
smiletan
authored
Merge pull request apache#389 from catpineapple/ddc-skip-default-systeminit
[improve](ddc)Enable ddc skip default systeminit check
2 parents b0ce8b1 + 1400525 commit 2d5ced9

File tree

8 files changed

+34
-8
lines changed

8 files changed

+34
-8
lines changed

api/disaggregated/v1/types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ type ComputeGroup struct {
9797
EnableWorkloadGroup bool `json:"enableWorkloadGroup,omitempty"`
9898

9999
CommonSpec `json:",inline"`
100+
101+
// SkipDefaultSystemInit is a switch that skips the default initialization and is used to set the default environment configuration required by the doris BE node.
102+
// Default value is 'false'.
103+
// Default System Init means that the container must be started in privileged mode.
104+
// 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.
105+
SkipDefaultSystemInit bool `json:"skipDefaultSystemInit,omitempty"`
100106
}
101107

102108
type CommonSpec struct {

config/crd/bases/crds.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11361,6 +11361,13 @@ spec:
1136111361
serviceAccount:
1136211362
description: serviceAccount for compute node access cloud service.
1136311363
type: string
11364+
skipDefaultSystemInit:
11365+
description: |-
11366+
SkipDefaultSystemInit is a switch that skips the default initialization and is used to set the default environment configuration required by the doris BE node.
11367+
Default value is 'false'.
11368+
Default System Init means that the container must be started in privileged mode.
11369+
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.
11370+
type: boolean
1136411371
startTimeout:
1136511372
description: pod start timeout, unit is second
1136611373
format: int32

config/crd/bases/disaggregated.cluster.doris.com_dorisdisaggregatedclusters.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,6 +2234,13 @@ spec:
22342234
serviceAccount:
22352235
description: serviceAccount for compute node access cloud service.
22362236
type: string
2237+
skipDefaultSystemInit:
2238+
description: |-
2239+
SkipDefaultSystemInit is a switch that skips the default initialization and is used to set the default environment configuration required by the doris BE node.
2240+
Default value is 'false'.
2241+
Default System Init means that the container must be started in privileged mode.
2242+
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.
2243+
type: boolean
22372244
startTimeout:
22382245
description: pod start timeout, unit is second
22392246
format: int32

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(skipDefaultInit 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(skipDefaultInit, 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(skipDefaultInit 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 !skipDefaultInit && 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
@@ -83,7 +83,7 @@ func (dcgs *DisaggregatedComputeGroupsController) NewStatefulset(ddc *dv1.DorisD
8383
}
8484

8585
func (dcgs *DisaggregatedComputeGroupsController) NewPodTemplateSpec(ddc *dv1.DorisDisaggregatedCluster, selector map[string]string, cvs map[string]interface{}, cg *dv1.ComputeGroup) corev1.PodTemplateSpec {
86-
pts := resource.NewPodTemplateSpecWithCommonSpec(&cg.CommonSpec, dv1.DisaggregatedBE)
86+
pts := resource.NewPodTemplateSpecWithCommonSpec(cg.SkipDefaultSystemInit, &cg.CommonSpec, dv1.DisaggregatedBE)
8787
//pod template metadata.
8888
func() {
8989
l := (resource.Labels)(selector)
@@ -142,6 +142,12 @@ func (dcgs *DisaggregatedComputeGroupsController) NewCGContainer(ddc *dv1.DorisD
142142
c.Env = append(c.Env, resource.GetPodDefaultEnv()...)
143143
c.Env = append(c.Env, dcgs.newSpecificEnvs(ddc, cg)...)
144144

145+
if cg.SkipDefaultSystemInit {
146+
// Only works when the doris version is higher than 2.1.8 or 3.0.4
147+
// 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.
148+
c.Env = append(c.Env, corev1.EnvVar{Name: "SKIP_CHECK_ULIMIT", Value: "true"})
149+
}
150+
145151
resource.BuildDisaggregatedProbe(&c, &cg.CommonSpec, dv1.DisaggregatedBE)
146152
_, vms, _ := dcgs.BuildVolumesVolumeMountsAndPVCs(cvs, dv1.DisaggregatedBE, &cg.CommonSpec)
147153
_, 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
@@ -91,7 +91,7 @@ func (dms *DisaggregatedMSController) newStatefulset(ddc *v1.DorisDisaggregatedC
9191
}
9292

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

0 commit comments

Comments
 (0)