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 pkg/common/utils/resource/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const (

DISAGGREGATED_FE_MAIN_CONTAINER_NAME = "fe"
DISAGGREGATED_BE_MAIN_CONTAINER_NAME = "compute"
DISAGGREGATED_MS_MAIN_CONTAINER_NAME= "metaservice"
)

type ProbeType string
Expand Down Expand Up @@ -738,6 +739,11 @@ func getFeDefaultVolumesVolumeMounts() ([]corev1.Volume, []corev1.VolumeMount) {
return volumes, volumMounts
}

//
func GetPodInfoVolumesVolumeMounts() ([]corev1.Volume, []corev1.VolumeMount){
return appendPodInfoVolumesVolumeMounts(nil, nil)
}

func appendPodInfoVolumesVolumeMounts(volumes []corev1.Volume, volumeMounts []corev1.VolumeMount) ([]corev1.Volume, []corev1.VolumeMount) {
if volumes == nil {
var _ []corev1.Volume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ func (dcgs *DisaggregatedComputeGroupsController) computeGroupSync(ctx context.C
func (dcgs *DisaggregatedComputeGroupsController) reconcileStatefulset(ctx context.Context, st *appv1.StatefulSet, cluster *dv1.DorisDisaggregatedCluster, cg *dv1.ComputeGroup) (*sc.Event, error) {
var est appv1.StatefulSet
if err := dcgs.K8sclient.Get(ctx, types.NamespacedName{Namespace: st.Namespace, Name: st.Name}, &est); apierrors.IsNotFound(err) {
//TODO: add downlaodAPI volume Mounts
dcgs.DisaggregatedSubDefaultController.AddDownwardAPI(st)
if err = k8s.CreateClientObject(ctx, dcgs.K8sclient, st); err != nil {
klog.Errorf("disaggregatedComputeGroupsController reconcileStatefulset create statefulset namespace=%s name=%s failed, err=%s", st.Namespace, st.Name, err.Error())
return &sc.Event{Type: sc.EventWarning, Reason: sc.CGCreateResourceFailed, Message: err.Error()}, err
Expand Down Expand Up @@ -206,6 +208,7 @@ func (dcgs *DisaggregatedComputeGroupsController) reconcileStatefulset(ctx conte
ddc_annos := (resource.Annotations)(cluster.Annotations)
msUniqueIdKey := strings.ToLower(fmt.Sprintf(dv1.UpdateStatefulsetName, cluster.GetCGStatefulsetName(cg)))
ddc_annos.Add(msUniqueIdKey, "true")
dcgs.DisaggregatedSubDefaultController.AddDownwardAPI(st)
}
return equal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ func (dms *DisaggregatedMSController) NewMSContainer(ddc *v1.DorisDisaggregatedC
cmd, args := sc.GetDisaggregatedCommand(v1.DisaggregatedMS)
c.Command = cmd
c.Args = args
c.Name = "metaservice"
//c.Name = "metaservice"
c.Name = resource.DISAGGREGATED_MS_MAIN_CONTAINER_NAME

c.Ports = resource.GetDisaggregatedContainerPorts(cvs, v1.DisaggregatedMS)
c.Env = ddc.Spec.MetaService.CommonSpec.EnvVars
Expand Down
14 changes: 13 additions & 1 deletion pkg/controller/sub_controller/disaggregated_subcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const (
FileCachePathKey = "file_cache_path"
FileCacheSubConfigPathKey = "path"
FileCacheSubConfigTotalSizeKey = "total_size"

)

type DisaggregatedSubController interface {
Expand Down Expand Up @@ -605,6 +604,19 @@ func (d *DisaggregatedSubDefaultController) getEmptyDirVolumesVolumeMounts(confM
}
}

// this function is a compensation, because the DownwardAPI annotations and labels are not mount in pod, so this function amends。
func(d *DisaggregatedSubDefaultController) AddDownwardAPI(st *appv1.StatefulSet) {
t := &st.Spec.Template
for index, _ := range t.Spec.Containers {
if t.Spec.Containers[index].Name == resource.DISAGGREGATED_FE_MAIN_CONTAINER_NAME || t.Spec.Containers[index].Name == resource.DISAGGREGATED_BE_MAIN_CONTAINER_NAME ||
t.Spec.Containers[index].Name == resource.DISAGGREGATED_MS_MAIN_CONTAINER_NAME {
_, d_v_m := resource.GetPodInfoVolumesVolumeMounts()
t.Spec.Containers[index].VolumeMounts = append(t.Spec.Containers[index].VolumeMounts, d_v_m...)
break
}
}
}

func (d *DisaggregatedSubDefaultController) getBEEmptyDirVolumesVolumeMounts(confMap map[string]interface{}) ([]corev1.Volume, []corev1.VolumeMount) {
vs := []corev1.Volume{
{
Expand Down