sub_controller

package
v0.0.0-...-da8f381 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatefulSetNotExist     = "StatefulSetNotExist"
	AutoScalerDeleteFailed  = "AutoScalerDeleteFailed"
	ComponentImageUpdate    = "ComponentImageUpdate"
	PVCListFailed           = "PVCListFailed"
	PVCUpdate               = "PVCUpdated"
	PVCUpdateFailed         = "PVCUpdateFailed"
	PVCDeleteFailed         = "PVCDeleteFailed"
	PVCCreate               = "PVCCreate"
	PVCCreateFailed         = "PVCCreateFailed"
	FollowerScaleDownFailed = "FollowerScaleDownFailed"
)

'reason' should be short and unique; it should be in UpperCamelCase format (starting with a capital letter).

Variables

This section is empty.

Functions

func EventString

func EventString(event *Event) string

func GetDisaggregatedCommand

func GetDisaggregatedCommand(componentType dv1.DisaggregatedComponentType) (commands []string, args []string)

func GetDisaggregatedPreStopScript

func GetDisaggregatedPreStopScript(componentType dv1.DisaggregatedComponentType) string

get the script path of prestop, this will be called before stop container.

Types

type DisaggregatedSubController

type DisaggregatedSubController interface {
	//Sync reconcile for sub controller. bool represent the component have updated.
	Sync(ctx context.Context, obj client.Object) error
	//clear all resource about sub-component.
	ClearResources(ctx context.Context, obj client.Object) (bool, error)

	//return the controller name, beController, feController,cnController for log.
	GetControllerName() string

	//UpdateStatus update the component status on src.
	UpdateComponentStatus(obj client.Object) error
}

type DisaggregatedSubDefaultController

type DisaggregatedSubDefaultController struct {
	K8sclient      client.Client
	K8srecorder    record.EventRecorder
	ControllerName string
}

func (*DisaggregatedSubDefaultController) BuildDefaultConfigMapVolumesVolumeMounts

func (d *DisaggregatedSubDefaultController) BuildDefaultConfigMapVolumesVolumeMounts(cms []v1.ConfigMap) ([]corev1.Volume, []corev1.VolumeMount)

func (*DisaggregatedSubDefaultController) CheckMSConfigMountPath

func (d *DisaggregatedSubDefaultController) CheckMSConfigMountPath(dms *mv1.DorisDisaggregatedMetaService, componentType mv1.ComponentType)

generate map for mountpath:configmap Deprecated:

func (*DisaggregatedSubDefaultController) ClassifyPodsByStatus

func (d *DisaggregatedSubDefaultController) ClassifyPodsByStatus(namespace string, status *mv1.BaseStatus, labels map[string]string, replicas int32) error

func (*DisaggregatedSubDefaultController) ClearMSCommonResources deprecated

func (d *DisaggregatedSubDefaultController) ClearMSCommonResources(ctx context.Context, dms *mv1.DorisDisaggregatedMetaService, componentType mv1.ComponentType) (bool, error)

Deprecated: ClearMSCommonResources clear common resources all component have, as statefulset, service. response `bool` represents all resource have deleted, if not and delete resource failed return false for next reconcile retry.

func (*DisaggregatedSubDefaultController) ConstructDefaultAffinity

func (d *DisaggregatedSubDefaultController) ConstructDefaultAffinity(matchKey, value string, ddcAffinity *corev1.Affinity) *corev1.Affinity

func (*DisaggregatedSubDefaultController) DefaultReconcileService

func (d *DisaggregatedSubDefaultController) DefaultReconcileService(ctx context.Context, svc *corev1.Service) (*Event, error)

the common logic to apply service, will used by fe,be,ms.

func (*DisaggregatedSubDefaultController) GetConfigValuesFromConfigMaps

func (d *DisaggregatedSubDefaultController) GetConfigValuesFromConfigMaps(namespace string, resolveKey string, cms []v1.ConfigMap) map[string]interface{}

func (*DisaggregatedSubDefaultController) GetMSConfig deprecated

func (d *DisaggregatedSubDefaultController) GetMSConfig(ctx context.Context, cms []mv1.ConfigMap, namespace string, componentType mv1.ComponentType) (map[string]interface{}, error)

Deprecated:

func (*DisaggregatedSubDefaultController) NewDefaultService

for config default values.

func (*DisaggregatedSubDefaultController) NewDefaultStatefulset

func (*DisaggregatedSubDefaultController) RestrictConditionsEqual

func (d *DisaggregatedSubDefaultController) RestrictConditionsEqual(nst *appv1.StatefulSet, est *appv1.StatefulSet)

RestrictConditionsEqual adds two StatefulSet, It is used to control the conditions for comparing. nst StatefulSet - a new StatefulSet est StatefulSet - an old StatefulSet

type Event

type Event struct {
	Type    EventType
	Reason  EventReason
	Message string
}

type EventReason

type EventReason string
var (
	ImageFormatError          EventReason = "ImageFormatError"
	FDBSpecEmpty              EventReason = "SpecEmpty"
	FDBAvailableButUnhealth   EventReason = "FDBAvailableButUnhealth"
	FESpecSetError            EventReason = "FESpecSetError"
	FECreateResourceFailed    EventReason = "FECreateResourceFailed"
	FEApplyResourceFailed     EventReason = "FEApplyResourceFailed"
	FEStatefulsetDeleteFailed EventReason = "FEStatefulsetDeleteFailed"
	FEHTTPFailed              EventReason = "FEHTTPResponseFailed"
	FEServiceDeleteFailed     EventReason = "FEServiceDeleteFailed"
	ComputeGroupsEmpty        EventReason = "CGsEmpty"
	CGSqlExecFailed           EventReason = "CGSqlExecFailed"
	//CGSuspendStatusRequestFailed    EventReason = "CGSuspendStatusRequestFailed"
	//CGResumeReplicasInconsistency   EventReason = "CGSuspendReplicasInconsistency"
	//CGResumeStatusRequestFailed     EventReason = "CGResumeStatusRequestFailed"
	CGUniqueIdentifierDuplicate     EventReason = "CGUniqueIdentifierDuplicate"
	CGUniqueIdentifierNotMatchRegex EventReason = "CGUniqueIdentifierNotMatchRegex"
	CGCreateResourceFailed          EventReason = "CGCreateResourceFailed"
	CGApplyResourceFailed           EventReason = "CGApplyResourceFailed"
	CGStatefulsetDeleteFailed       EventReason = "CGStatefulsetDeleteFailed"
	CGServiceDeleteFailed           EventReason = "CGServiceDeleteFailed"
	ConfigMapPathRepeated           EventReason = "ConfigMapPathRepeated"
	WaitMetaServiceAvailable        EventReason = "WaitMetaServiceAvailable"
	WaitFEAvailable                 EventReason = "WaitFEAvailable"
	ServiceApplyedFailed            EventReason = "ServiceApplyedFailed"
	MSServiceDeletedFailed          EventReason = "MSServiceDeletedFailed"
	MSStatefulsetDeleteFailed       EventReason = "MSStatefulsetDeleteFailed"
	FDBAddressNotConfiged           EventReason = "FDBAddressNotConfiged"
)

type EventType

type EventType string

define event type for sub controller, Type can be one of Normal, Warning.

var (
	EventNormal  EventType = "Normal"
	EventWarning EventType = "Warning"
)

only Normal Warning, not add new type.

type SubController

type SubController interface {
	//Sync reconcile for sub controller. bool represent the component have updated.
	Sync(ctx context.Context, cluster *dorisv1.DorisCluster) error
	//clear all resource about sub-component.
	ClearResources(ctx context.Context, cluster *dorisv1.DorisCluster) (bool, error)

	//return the controller name, beController, feController,cnController for log.
	GetControllerName() string

	//UpdateStatus update the component status on src.
	UpdateComponentStatus(cluster *dorisv1.DorisCluster) error
}

type SubDefaultController

type SubDefaultController struct {
	K8sclient   client.Client
	K8srecorder record.EventRecorder
}

SubDefaultController define common function for all component about doris.

func (*SubDefaultController) CheckConfigMountPath

func (d *SubDefaultController) CheckConfigMountPath(dcr *dorisv1.DorisCluster, componentType dorisv1.ComponentType)

generate map for mountpath:configmap

func (*SubDefaultController) ClassifyPodsByStatus

func (d *SubDefaultController) ClassifyPodsByStatus(namespace string, status *dorisv1.ComponentStatus, labels map[string]string, replicas int32) error

func (*SubDefaultController) ClearCommonResources

func (d *SubDefaultController) ClearCommonResources(ctx context.Context, dcr *dorisv1.DorisCluster, componentType dorisv1.ComponentType) (bool, error)

ClearCommonResources clear common resources all component have, as statefulset, service. response `bool` represents all resource have deleted, if not and delete resource failed return false for next reconcile retry.

func (*SubDefaultController) FeAvailable

func (d *SubDefaultController) FeAvailable(dcr *dorisv1.DorisCluster) bool

func (*SubDefaultController) GetConfig

func (d *SubDefaultController) GetConfig(ctx context.Context, configMapInfo *dorisv1.ConfigMapInfo, namespace string, componentType dorisv1.ComponentType) (map[string]interface{}, error)

func (*SubDefaultController) InitStatus

func (d *SubDefaultController) InitStatus(dcr *dorisv1.DorisCluster, componentType dorisv1.ComponentType)

func (*SubDefaultController) PrepareReconcileResources

func (d *SubDefaultController) PrepareReconcileResources(ctx context.Context, dcr *dorisv1.DorisCluster, componentType dorisv1.ComponentType) bool

PrepareReconcileResources prepare resource for reconcile response: bool, if true presents resource have ready for reconciling, if false presents resource is preparing.

func (*SubDefaultController) RecycleResources

func (d *SubDefaultController) RecycleResources(ctx context.Context, dcr *dorisv1.DorisCluster, componentType dorisv1.ComponentType) error

RecycleResources pvc resource for recycle

func (*SubDefaultController) RestrictConditionsEqual

func (d *SubDefaultController) RestrictConditionsEqual(nst *appv1.StatefulSet, est *appv1.StatefulSet)

RestrictConditionsEqual adds two StatefulSet, It is used to control the conditions for comparing. nst StatefulSet - a new StatefulSet est StatefulSet - an old StatefulSet

func (*SubDefaultController) UpdateStatus

func (d *SubDefaultController) UpdateStatus(namespace string, status *dorisv1.ComponentStatus, labels map[string]string, replicas int32) error

UpdateStatus update the component status on src.

Directories

Path Synopsis
disaggregated_cluster
disaggregated_metaservice
fdb
ms

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL