Skip to content

Commit

Permalink
compute group finished deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
intelligentfu8 committed Jul 10, 2024
1 parent 9584eba commit 61cc2a0
Show file tree
Hide file tree
Showing 16 changed files with 315 additions and 111 deletions.
34 changes: 30 additions & 4 deletions api/disaggregated/cluster/v1/doris_disaggregated_cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import (
)

type DorisDisaggregatedClusterSpec struct {
//TODO: give the example config.
//VaultConfigmap specify the configmap that have configuration of file object information. example S3.
//configmap have to config, please reference the doc.
VaultConfigmap string `json:"vaultConfigmap,omitempty"`
InstanceConfigMap string `json:"instanceConfigMap,omitempty"`

//MetaService describe the metaservice that cluster want to storage metadata.
MetaService MetaService `json:"metaService,omitempty"`
DisMS DisMS `json:"disMS,omitempty"`

//FeSpec describe the fe specification of doris disaggregated cluster.
FeSpec FeSpec `json:"feSpec,omitempty"`
Expand All @@ -21,7 +20,7 @@ type DorisDisaggregatedClusterSpec struct {
ComputeGroups []ComputeGroup `json:"computeGroups,omitempty"`
}

type MetaService struct {
type DisMS struct {
//Namespace specify the namespace of metaservice deployed.
Namespace string `json:"namespace,omitempty"`
//Name specify the name of metaservice resource.
Expand Down Expand Up @@ -199,9 +198,31 @@ type DorisDisaggregatedClusterStatus struct {
//FEStatus describe the fe status.
FEStatus FEStatus `json:"feStatus,omitempty"`

ClusterHealth ClusterHealth `json:"clusterHealth,omitempty"`

//ComputeGroupStatuses reflect a list of computecgroup status.
ComputeGroupStatuses []ComputeGroupStatus `json:"computeGroupStatuses,omitempty"`
}
type Health string

var (
Green Health = "green"
Yellow Health = "yellow"
Red Health = "red"
)

type ClusterHealth struct {
//represents the cluster overall status.
Health Health `json:"health,omitempty"`
//represents the fe available or not.
FeAvailable bool `json:"feAvailable,omitempty"`
//the number of compute group.
CGCount int32 `json:"cgCount,omitempty"`
//the available numbers of compute group.
CGAvailableCount int32 `json:"cgAvailableCount,omitempty"`
//the full available numbers of compute group, represents all pod in compute group are ready.
CGFullAvailableCount int32 `json:"cgFullAvailableCount,omitempty"`
}

type Phase string

Expand Down Expand Up @@ -265,6 +286,11 @@ type FEStatus struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=ddc
// +kubebuilder:printcolumn:name="ClusterHealth",type=string,JSONPath=`.status.clusterHealth.health`
// +kubebuilder:printcolumn:name="FEPhase",type=string,JSONPath=`.status.feStatus.phase`
// +kubebuilder:printcolumn:name="CGCount",type=integer,JSONPath=`.status.clusterHealth.cgCount`
// +kubebuilder:printcolumn:name="CGAvailableCount",type=integer,JSONPath=`.status.clusterHealth.cgAvailableCount`
// +kubebuilder:printcolumn:name="CGFullAvailableCount",type=integer,JSONPath=`.status.clusterHealth.cgFullAvailableCount`
// +kubebuilder:storageversion
// DorisDisaggregatedCluster defined as CRD format, have type, metadata, spec, status, fields.
type DorisDisaggregatedCluster struct {
Expand Down
21 changes: 14 additions & 7 deletions api/disaggregated/cluster/v1/unique_id.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package v1

import (
"fmt"
"strings"
)

Expand All @@ -9,17 +10,20 @@ please use get function to replace new function.
*/

func newCGStatefulsetName(ddcName /*dorisDisaggregatedCluster Name*/, cgName /*computegroup's name*/ string) string {
return ddcName + "-" + cgName
//cgName use "_", but name in kubernetes object use "-"
stName := ddcName + "-" + cgName
stName = strings.ReplaceAll(stName, "_", "-")
return stName
}

// RE:[a-zA-Z][0-9a-zA-Z_]+
func newCGClusterId(namespace, stsName string) string {
return strings.ReplaceAll(namespace+"_"+stsName, "-", "_")
}

// RE:[a-zA-Z][0-9a-zA-Z_]+
func newCGCloudUniqueId(namespace, instanceName, statefulsetName string) string {
return strings.ReplaceAll("1:"+namespace+"_"+instanceName+":"+statefulsetName, "-", "_")
// cloudUniqueID match "1:$instanceId:[a-zA-Z]"
func newCGCloudUniqueId(instanceId, statefulsetName string) string {
return fmt.Sprintf("1:%s:%s", instanceId, statefulsetName)
}

func (ddc *DorisDisaggregatedCluster) GetCGStatefulsetName(cg *ComputeGroup) string {
Expand All @@ -41,7 +45,7 @@ func (ddc *DorisDisaggregatedCluster) GetInstanceId() string {
return ddc.Status.InstanceId
}

// need config in CR.
// need config in vaultConfigMap.
return ""
}
func (ddc *DorisDisaggregatedCluster) GetCGClusterId(cg *ComputeGroup) string {
Expand Down Expand Up @@ -76,7 +80,8 @@ func (ddc *DorisDisaggregatedCluster) GetCGCloudUniqueId(cg *ComputeGroup) strin
statefulsetName := ddc.GetCGStatefulsetName(cg)
//update cg' clusterId for auto assemble, if not config.
if cg.CloudUniqueId == "" {
cg.CloudUniqueId = newCGCloudUniqueId(ddc.Namespace, ddc.Name, statefulsetName)
instanceId := ddc.GetInstanceId()
cg.CloudUniqueId = newCGCloudUniqueId(instanceId, statefulsetName)
}

return cg.CloudUniqueId
Expand All @@ -98,7 +103,9 @@ func (ddc *DorisDisaggregatedCluster) GetCGServiceName(cg *ComputeGroup) string
return svcName
}

return ddc.Name + "-" + cg.Name
svcName = ddc.Name + "-" + cg.Name
svcName = strings.ReplaceAll(svcName, "_", "-")
return svcName
}

func (ddc *DorisDisaggregatedCluster) GetFEServiceName() string {
Expand Down
48 changes: 32 additions & 16 deletions api/disaggregated/cluster/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
// +kubebuilder:printcolumn:name="MSStatus",type=string,JSONPath=`.status.msStatus.phase`
// +kubebuilder:printcolumn:name="RecyclerStatus",type=string,JSONPath=`.status.recyclerStatus.phase`
// +kubebuilder:storageversion
// +kubebuilder:resource:shortName=ddms
// +kubebuilder:resource:shortName=ddm
// DorisDisaggregatedMetaService is the Schema for the DorisDisaggregatedMetaServices API
type DorisDisaggregatedMetaService struct {
metav1.TypeMeta `json:",inline"`
Expand Down
3 changes: 1 addition & 2 deletions api/disaggregated/metaservice/v1/type_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,5 @@ func IsReconcilingStatusPhase(c MetaServicePhase) bool {
}

func (ddm *DorisDisaggregatedMetaService) GetMSServiceName() string {
//TODO: cancel after merge code
return ""
return GenerateCommunicateServiceName(ddm, Component_MS)
}
1 change: 1 addition & 0 deletions cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func init() {
//add foundationdb scheme
utilruntime.Must(v1beta2.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme

controller.Controllers = append(controller.Controllers, &controller.DorisClusterReconciler{}, &unnamedwatches.WResource{},
&controller.DisaggregatedClusterReconciler{}, &controller.DisaggregatedMetaServiceReconciler{})
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/common/utils/disaggregated_ms/ms_http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
)

const (
CREATE_INSTANCE_PREFIX_TEMPLATE = `%s/MetaService/http/create_instance?token=%s`
DELETE_INSTANCE_PREFIX_TEMPLATE = `%s/MetaService/http/drop_instance?token=%s`
GET_INSTANCE_PREFIX_TEMPLATE = `%s/MetaService/http/get_instance?token=%s&instance_id=%s`
CREATE_INSTANCE_PREFIX_TEMPLATE = `http://%s/MetaService/http/create_instance?token=%s`
DELETE_INSTANCE_PREFIX_TEMPLATE = `http://%s/MetaService/http/drop_instance?token=%s`
GET_INSTANCE_PREFIX_TEMPLATE = `http://%s/MetaService/http/get_instance?token=%s&instance_id=%s`
)

//realize the metaservice interface
Expand Down
1 change: 1 addition & 0 deletions pkg/common/utils/disaggregated_ms/ms_http/metaservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type MSResponse struct {

const (
SuccessCode string = "OK"
ALREADY_EXIST string = "ALREADY_EXISTED"
NotFound string = "NOT_FOUND"
INTERNAL_ERROR string = "INTERNAL_ERROR"
)
18 changes: 11 additions & 7 deletions pkg/common/utils/disaggregated_ms/ms_meta/struct.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package ms_meta

// vault
const (
Instance_id string = "instance_id"
Name string = "name"
User_id string = "user_id"
Vault string = "vault"
)

// S3
const (
Instance_id string = "instance_id"
Instance_name string = "name"
User_id string = "user_id"
Obj_info string = "obj_info"
Obj_info_ak string = "ak"
Obj_info_sk string = "sk"
Expand All @@ -14,10 +19,9 @@ const (
Obj_info_region string = "region"
Obj_info_external_endpoint string = "external_endpoint"
Obj_info_provider string = "provider"
Obj_info_user_id string = "user_id"
Ram_user string = "ram_user"
Ram_user_ak string = "ak"
Ram_user_sk string = "sk"
//Ram_user string = "ram_user"
//Ram_user_ak string = "ak"
//Ram_user_sk string = "sk"
)

// HDFS
Expand Down
2 changes: 1 addition & 1 deletion pkg/common/utils/resource/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func GetPortKey(configKey string) string {
case BROKER_IPC_PORT:
return strings.ReplaceAll(BROKER_IPC_PORT, "_", "-")
case BRPC_LISTEN_PORT:
return "ms-brpc-port"
return "brpc-port"
default:
return ""
}
Expand Down
Loading

0 comments on commit 61cc2a0

Please sign in to comment.