sub_controller

package
v0.0.0-...-6cf8b2f Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 19 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) CheckMSConfigMountPath

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

generate map for mountpath:configmap

func (*DisaggregatedSubDefaultController) ClassifyPodsByStatus

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

func (*DisaggregatedSubDefaultController) ClearCommonResources

func (d *DisaggregatedSubDefaultController) ClearCommonResources(ctx context.Context, dms *mv1.DorisDisaggregatedMetaService, componentType mv1.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 (*DisaggregatedSubDefaultController) GetMSConfig

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

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"
	FEServiceDeleteFailed             EventReason = "FEServiceDeleteFailed"
	ComputeGroupsEmpty                EventReason = "CGsEmpty"
	CGUniqueIdentifierDuplicate       EventReason = "CGUniqueIdentifierDuplicate"
	CGUniqueIdentifierNotMatchRegex   EventReason = "CGUniqueIdentifierNotMatchRegex"
	CGCreateResourceFailed            EventReason = "CGCreateResourceFailed"
	CGApplyResourceFailed             EventReason = "CGApplyResourceFailed"
	CGStatusUpdateFailed              EventReason = "CGStatusUpdatedFailed"
	CGStatefulsetDeleteFailed         EventReason = "CGStatefulsetDeleteFailed"
	CGServiceDeleteFailed             EventReason = "CGServiceDeleteFailed"
	DisaggregatedMetaServiceGetFailed EventReason = "DisaggregatedMetaServiceGetFailed"
	ObjectInfoInvalid                 EventReason = "ObjectInfoInvalid"
	ConfigMapGetFailed                EventReason = "ConfigMapGetFailed"
	ObjectConfigError                 EventReason = "ObjectConfigError"
	MSInteractError                   EventReason = "MSInteractError"
	InstanceMetaCreated               EventReason = "InstanceMetaCreated"
	InstanceIdModified                EventReason = "InstanceIdModified"
	ConfigMapPathRepeated             EventReason = "ConfigMapPathRepeated"
)

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