Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ metadata:
name: {{ include "doris-disaggregated.name" . }}
{{- if .Values.Labels }}
labels:
{{- .Values.Labels | nindent 4 }}
{{- toYaml .Values.Labels | nindent 4 }}
{{- end }}
spec:
{{- if .Values.adminUser }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,26 @@ func (dcgs *DisaggregatedComputeGroupsController) NewStatefulset(ddc *dv1.DorisD
st.Spec.Replicas = cg.Replicas
st.Spec.VolumeClaimTemplates = vcts
st.Spec.ServiceName = ddc.GetCGServiceName(cg)
pts := dcgs.NewPodTemplateSpec(ddc, matchLabels, cvs, cg)
pts := dcgs.NewPodTemplateSpec(ddc, cvs, cg)
st.Spec.Template = pts
}()

return st
}

func (dcgs *DisaggregatedComputeGroupsController) NewPodTemplateSpec(ddc *dv1.DorisDisaggregatedCluster, selector map[string]string, cvs map[string]interface{}, cg *dv1.ComputeGroup) corev1.PodTemplateSpec {
func (dcgs *DisaggregatedComputeGroupsController) getCGPodLabels(ddc *dv1.DorisDisaggregatedCluster, cg *dv1.ComputeGroup) resource.Labels {
selector := dcgs.newCGPodsSelector(ddc.Name, cg.UniqueId)
labels := (resource.Labels)(selector)
labels.AddLabel(cg.Labels)
return labels

}

func (dcgs *DisaggregatedComputeGroupsController) NewPodTemplateSpec(ddc *dv1.DorisDisaggregatedCluster, cvs map[string]interface{}, cg *dv1.ComputeGroup) corev1.PodTemplateSpec {
pts := resource.NewPodTemplateSpecWithCommonSpec(cg.SkipDefaultSystemInit, &cg.CommonSpec, dv1.DisaggregatedBE)
//pod template metadata.
func() {
l := (resource.Labels)(selector)
l.AddLabel(pts.Labels)
pts.Labels = l
}()

labels := dcgs.getCGPodLabels(ddc, cg)
pts.Labels = labels
c := dcgs.NewCGContainer(ddc, cvs, cg)
pts.Spec.Containers = append(pts.Spec.Containers, c)

Expand All @@ -118,7 +122,7 @@ func (dcgs *DisaggregatedComputeGroupsController) NewPodTemplateSpec(ddc *dv1.Do

//add last supplementary spec. if add new config in ddc spec and the config need add in pod, use the follow function to add.
dcgs.DisaggregatedSubDefaultController.AddClusterSpecForPodTemplate(dv1.DisaggregatedBE, cvs, &ddc.Spec, &pts)
cgUniqueId := selector[dv1.DorisDisaggregatedComputeGroupUniqueId]
cgUniqueId := labels[dv1.DorisDisaggregatedComputeGroupUniqueId]
pts.Spec.Affinity = dcgs.ConstructDefaultAffinity(dv1.DorisDisaggregatedComputeGroupUniqueId, cgUniqueId, pts.Spec.Affinity)

return pts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,33 @@ func (dms *DisaggregatedMSController) newStatefulset(ddc *v1.DorisDisaggregatedC
st.Spec.Selector = &metav1.LabelSelector{
MatchLabels: matchLabels,
}
st.Spec.Template = dms.NewPodTemplateSpec(ddc, matchLabels, confMap)
st.Spec.Template = dms.NewPodTemplateSpec(ddc, confMap)
st.Spec.ServiceName = ddc.GetMSServiceName()
st.Spec.VolumeClaimTemplates = vcts
}()

return st
}

func (dms *DisaggregatedMSController) NewPodTemplateSpec(ddc *v1.DorisDisaggregatedCluster, selector map[string]string, confMap map[string]interface{}) corev1.PodTemplateSpec {
func (dms *DisaggregatedMSController) getMSPodLabels(ddc *v1.DorisDisaggregatedCluster) resource.Labels {
selector := dms.newMSPodsSelector(ddc.Name)
labels := (resource.Labels)(selector)
labels.AddLabel(ddc.Spec.MetaService.Labels)
return labels
}

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

labels := dms.getMSPodLabels(ddc)
pts.Labels = labels
c := dms.NewMSContainer(ddc, confMap)
pts.Spec.Containers = append(pts.Spec.Containers, c)
vs, _, _ := dms.BuildVolumesVolumeMountsAndPVCs(confMap, v1.DisaggregatedMS, &ddc.Spec.MetaService.CommonSpec)
configVolumes, _ := dms.BuildDefaultConfigMapVolumesVolumeMounts(ddc.Spec.MetaService.ConfigMaps)
pts.Spec.Volumes = append(pts.Spec.Volumes, vs...)
pts.Spec.Volumes = append(pts.Spec.Volumes, configVolumes...)
pts.Spec.Affinity = dms.ConstructDefaultAffinity(v1.DorisDisaggregatedClusterName, selector[v1.DorisDisaggregatedClusterName], ddc.Spec.MetaService.Affinity)
pts.Spec.Affinity = dms.ConstructDefaultAffinity(v1.DorisDisaggregatedClusterName, labels[v1.DorisDisaggregatedClusterName], ddc.Spec.MetaService.Affinity)

if len(ddc.Spec.MetaService.Secrets) != 0 {
secretVolumes, _ := resource.GetMultiSecretVolumeAndVolumeMountWithCommonSpec(&ddc.Spec.MetaService.CommonSpec)
Expand Down