Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions api/disaggregated/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ type ComputeGroup struct {
UniqueId string `json:"uniqueId"`

CommonSpec `json:",inline"`

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

type CommonSpec struct {
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11361,6 +11361,13 @@ spec:
serviceAccount:
description: serviceAccount for compute node access cloud service.
type: string
skipDefaultSystemInit:
description: |-
SkipDefaultSystemInit is a switch that skips the default initialization and is used to set the default environment configuration required by the doris BE node.
Default value is 'false'.
Default System Init means that the container must be started in privileged mode.
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.
type: boolean
startTimeout:
description: pod start timeout, unit is second
format: int32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,13 @@ spec:
serviceAccount:
description: serviceAccount for compute node access cloud service.
type: string
skipDefaultSystemInit:
description: |-
SkipDefaultSystemInit is a switch that skips the default initialization and is used to set the default environment configuration required by the doris BE node.
Default value is 'false'.
Default System Init means that the container must be started in privileged mode.
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.
type: boolean
startTimeout:
description: pod start timeout, unit is second
format: int32
Expand Down
8 changes: 4 additions & 4 deletions pkg/common/utils/resource/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func NewPodTemplateSpec(dcr *v1.DorisCluster, config map[string]interface{}, com
}

// for disaggregated cluster.
func NewPodTemplateSpecWithCommonSpec(cs *dv1.CommonSpec, componentType dv1.DisaggregatedComponentType) corev1.PodTemplateSpec {
func NewPodTemplateSpecWithCommonSpec(skipDefaultInit bool, cs *dv1.CommonSpec, componentType dv1.DisaggregatedComponentType) corev1.PodTemplateSpec {
var vs []corev1.Volume
si := cs.SystemInitialization
var defaultInitContainers []corev1.Container
Expand All @@ -214,7 +214,7 @@ func NewPodTemplateSpecWithCommonSpec(cs *dv1.CommonSpec, componentType dv1.Disa
Volumes: vs,
},
}
constructDisaggregatedInitContainers(componentType, &pts.Spec, si)
constructDisaggregatedInitContainers(skipDefaultInit, componentType, &pts.Spec, si)
return pts
}

Expand Down Expand Up @@ -264,7 +264,7 @@ func constructInitContainers(skipInit bool, componentType v1.ComponentType, podS
podSpec.InitContainers = append(podSpec.InitContainers, defaultInitContains...)
}

func constructDisaggregatedInitContainers(componentType dv1.DisaggregatedComponentType, podSpec *corev1.PodSpec, si *dv1.SystemInitialization) {
func constructDisaggregatedInitContainers(skipDefaultInit bool, componentType dv1.DisaggregatedComponentType, podSpec *corev1.PodSpec, si *dv1.SystemInitialization) {
initImage := DEFAULT_INIT_IMAGE
var defaultInitContains []corev1.Container
if si != nil {
Expand All @@ -287,7 +287,7 @@ func constructDisaggregatedInitContainers(componentType dv1.DisaggregatedCompone
}

// the init containers have sequence,should confirm use initial is always in the first priority.
if componentType == dv1.DisaggregatedBE {
if !skipDefaultInit && componentType == dv1.DisaggregatedBE {
podSpec.InitContainers = append(podSpec.InitContainers, constructBeDefaultInitContainer(initImage))
}
podSpec.InitContainers = append(podSpec.InitContainers, defaultInitContains...)
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/utils/resource/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func Test_NewPodTemplateSpecWithCommonSpec(t *testing.T) {
tm[dv1.DisaggregatedMS] = mcs

for dct, cs := range tm {
pts := NewPodTemplateSpecWithCommonSpec(cs, dct)
pts := NewPodTemplateSpecWithCommonSpec(false, cs, dct)
t.Log(pts)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (dcgs *DisaggregatedComputeGroupsController) NewStatefulset(ddc *dv1.DorisD
}

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

if cg.SkipDefaultSystemInit {
// Only works when the doris version is higher than 2.1.8 or 3.0.4
// 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.
c.Env = append(c.Env, corev1.EnvVar{Name: "SKIP_CHECK_ULIMIT", Value: "true"})
}

resource.BuildDisaggregatedProbe(&c, &cg.CommonSpec, dv1.DisaggregatedBE)
_, vms, _ := dcgs.BuildVolumesVolumeMountsAndPVCs(cvs, dv1.DisaggregatedBE, &cg.CommonSpec)
_, cmvms := dcgs.BuildDefaultConfigMapVolumesVolumeMounts(cg.ConfigMaps)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (dfc *DisaggregatedFEController) getFEPodLabels(ddc *v1.DorisDisaggregatedC
}

func (dfc *DisaggregatedFEController) NewPodTemplateSpec(ddc *v1.DorisDisaggregatedCluster, confMap map[string]interface{}) corev1.PodTemplateSpec {
pts := resource.NewPodTemplateSpecWithCommonSpec(&ddc.Spec.FeSpec.CommonSpec, v1.DisaggregatedFE)
pts := resource.NewPodTemplateSpecWithCommonSpec(false, &ddc.Spec.FeSpec.CommonSpec, v1.DisaggregatedFE)
//pod template metadata.
labels := dfc.getFEPodLabels(ddc)
pts.Labels = labels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (dms *DisaggregatedMSController) newStatefulset(ddc *v1.DorisDisaggregatedC
}

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