common

package
v0.0.0-...-ae2b673 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FEConfigFilename = constants.FEConfigFilename
	BEConfigFilename = constants.BEConfigFilename
)
View Source
const ContainerVector = "vector"

Variables

This section is empty.

Functions

func CreateServiceMetricsName

func CreateServiceMetricsName(roleGroupInfo *reconciler.RoleGroupInfo) string

func ExtendConfigMapByVector

func ExtendConfigMapByVector(ctx context.Context, params VectorConfigParams, data map[string]string)

func GetComponentImage

func GetComponentImage(imageSpec *dorisv1alpha1.ImageSpec, componentType constants.ComponentType) string

GetComponentImage returns the appropriate image for a specific component (BE or FE)

func GetInitContainerImage

func GetInitContainerImage() string

GetInitContainerImage returns the image to use for init containers

func GetMetricsPort

func GetMetricsPort(role string) (int32, error)

GetMetricsPort returns the metrics port for the given role

func GetPullPolicy

func GetPullPolicy(imageSpec *dorisv1alpha1.ImageSpec) corev1.PullPolicy

GetPullPolicy returns the image pull policy to use

func GetServiceName

func GetServiceName(clusterName string, componentType constants.ComponentType, serviceType ServiceType) string

Get service name based on component type and service type

func GetVectorConfigMapName

func GetVectorConfigMapName(cluster *dorisv1alpha1.DorisCluster) string

func GetVectorFactory

func GetVectorFactory(
	image *util.Image,
) *builder.Vector

GetVectorFactory returns a new vector factory can provide vector container, volumes

func IsVectorEnable

func IsVectorEnable(roleLoggingConfig *commonsv1alpha1.LoggingSpec) bool

func NewAccessServiceReconciler

func NewAccessServiceReconciler(
	client *client.Client,
	roleGroupInfo *reconciler.RoleGroupInfo,
	config *ComponentServiceConfig,
) reconciler.ResourceReconciler[builder.ServiceBuilder]

NewAccessServiceReconciler creates an access service reconciler for a Doris component

func NewConfigMapBuilder

func NewConfigMapBuilder(
	ctx context.Context,
	client *client.Client,
	componentType constants.ComponentType,
	roleGroupInfo *reconciler.RoleGroupInfo,
	overrides *commonsv1alpha1.OverridesSpec,
	roleConfig *commonsv1alpha1.RoleGroupConfigSpec,
	dorisCluster *dorisv1alpha1.DorisCluster,
	component ConfigMapComponentBuilder,
	vectorvectorAggregatorConfigMapName string,
) builder.ConfigBuilder

NewConfigMapBuilder creates a new ConfigMapBuilder with common configuration

func NewDorisServiceBuilder

func NewDorisServiceBuilder(
	client *client.Client,
	serviceType ServiceType,
	roleGroupInfo *reconciler.RoleGroupInfo,
	config *ComponentServiceConfig,
) builder.ServiceBuilder

NewDorisServiceBuilder creates a new DorisServiceBuilder

func NewInternalServiceReconciler

func NewInternalServiceReconciler(
	client *client.Client,
	roleGroupInfo *reconciler.RoleGroupInfo,
	config *ComponentServiceConfig,
) reconciler.ResourceReconciler[builder.ServiceBuilder]

NewInternalServiceReconciler creates an internal service reconciler for a Doris component

func NewRoleGroupMetricsService

func NewRoleGroupMetricsService(
	client *client.Client,
	roleGroupInfo *reconciler.RoleGroupInfo,
) reconciler.Reconciler

NewRoleGroupMetricsService creates a metrics service reconciler using a simple function approach This creates a headless service for metrics with Prometheus labels and annotations

func RegisterStandardResources

func RegisterStandardResources(
	ctx context.Context,
	client *client.Client,
	builder DorisComponentResourceBuilder,
	replicas *int32,
	image *opgoutil.Image,
	dorisCluster *dorisv1alpha1.DorisCluster,
	clusterOperation *commonsv1alpha1.ClusterOperationSpec,
	roleGroupInfo *reconciler.RoleGroupInfo,
	config *dorisv1alpha1.ConfigSpec,
	overrides *commonsv1alpha1.OverridesSpec,
) ([]reconciler.Reconciler, error)

RegisterStandardResources registers common resources for a Doris component

Types

type BaseDorisRoleReconciler

type BaseDorisRoleReconciler struct {
	reconciler.BaseRoleReconciler[*dorisv1alpha1.RoleSpec]
	DorisCluster     *dorisv1alpha1.DorisCluster
	ClusterConfig    *dorisv1alpha1.ClusterConfigSpec
	ClusterOperation *commonsv1alpha1.ClusterOperationSpec
	Image            *opgoutil.Image
	ComponentType    string
	ComponentRec     DorisComponentReconciler
}

BaseDorisRoleReconciler is the common base for both FE and BE role reconcilers

func NewBaseDorisRoleReconciler

func NewBaseDorisRoleReconciler(
	client *client.Client,
	roleInfo reconciler.RoleInfo,
	spec *dorisv1alpha1.RoleSpec,
	dorisCluster *dorisv1alpha1.DorisCluster,
	image *opgoutil.Image,
	componentType string,
	componentRec DorisComponentReconciler,
) *BaseDorisRoleReconciler

NewBaseDorisRoleReconciler creates a new base role reconciler for Doris components

func (*BaseDorisRoleReconciler) RegisterResources

func (r *BaseDorisRoleReconciler) RegisterResources(ctx context.Context) error

RegisterResources registers all resources for all role groups

type ComponentServiceConfig

type ComponentServiceConfig struct {
	// ComponentType is the type of component (FE/BE)
	ComponentType constants.ComponentType

	// InternalPorts defines which ports to expose in the internal headless service
	InternalPorts []corev1.ContainerPort

	// AccessPorts defines which ports to expose in the access service
	AccessPorts []corev1.ContainerPort
}

ComponentServiceConfig defines the port configuration for a specific component

type ComponentType

type ComponentType string

ComponentType represents different Doris component types

const (
	ComponentTypeFE ComponentType = "fe"
	ComponentTypeBE ComponentType = "be"
)

type ConfigMapBuilder

type ConfigMapBuilder struct {
	builder.ConfigMapBuilder
	// contains filtered or unexported fields
}

ConfigMapBuilder is the common builder for Doris ConfigMaps

func (*ConfigMapBuilder) Build

Build constructs the ConfigMap object combining common and component-specific configurations

type ConfigMapComponentBuilder

type ConfigMapComponentBuilder interface {
	// BuildConfig returns component-specific configuration content
	BuildConfig(ctx context.Context) (map[string]string, error)
}

ConfigMapComponentBuilder defines methods that should be implemented by BE/FE specific builders

type DorisComponentReconciler

type DorisComponentReconciler interface {
	// RegisterResourceWithRoleGroup registers resources for a specific role group
	RegisterResourceWithRoleGroup(
		ctx context.Context,
		replicas *int32,
		roleGroupInfo *reconciler.RoleGroupInfo,
		overrides *commonsv1alpha1.OverridesSpec,
		config *dorisv1alpha1.ConfigSpec,
	) ([]reconciler.Reconciler, error)
}

DorisComponentReconciler is the interface that all component reconcilers must implement

type DorisComponentResourceBuilder

type DorisComponentResourceBuilder interface {
	// CreateServiceReconcilers returns internal and access service reconcilers
	CreateServiceReconcilers(
		client *client.Client,
		roleGroupInfo *reconciler.RoleGroupInfo,
	) []reconciler.Reconciler

	// CreateStatefulSetReconciler returns statefulset reconciler
	CreateStatefulSetReconciler(
		ctx context.Context,
		client *client.Client,
		image *opgoutil.Image,
		replicas *int32,
		dorisCluster *dorisv1alpha1.DorisCluster,
		clusterOperation *commonsv1alpha1.ClusterOperationSpec,
		roleGroupInfo *reconciler.RoleGroupInfo,
		config *dorisv1alpha1.ConfigSpec,
		overrides *commonsv1alpha1.OverridesSpec,
	) (reconciler.Reconciler, error)
}

DorisComponentResourceBuilder defines methods that component implementations should provide

type DorisServiceBuilder

type DorisServiceBuilder struct {
	*builder.BaseServiceBuilder
	// contains filtered or unexported fields
}

DorisServiceBuilder implements the ServiceBuilder interface for Doris services

func (*DorisServiceBuilder) GetObject

func (b *DorisServiceBuilder) GetObject() *corev1.Service

GetObject returns the final Service object

type ServiceType

type ServiceType string

ServiceType defines the different types of services for Doris components

const (
	// ServiceTypeInternal is for internal (headless) services
	ServiceTypeInternal ServiceType = "internal"

	// ServiceTypeAccess is for externally accessible services
	ServiceTypeAccess ServiceType = "access"
)

type StatefulSetBuilder

type StatefulSetBuilder struct {
	*builder.StatefulSet
	// contains filtered or unexported fields
}

StatefulSetBuilder is the common builder for Doris StatefulSets

func NewStatefulSetBuilder

func NewStatefulSetBuilder(
	ctx context.Context,
	client *client.Client,
	componentType constants.ComponentType,
	roleGroupInf *reconciler.RoleGroupInfo,
	image *opgoutil.Image,
	replicas *int32,
	roleConfig *dorisv1alpha1.ConfigSpec,
	overrdes *commonsv1alpha1.OverridesSpec,
	dorisCluster *dorisv1alpha1.DorisCluster,
) *StatefulSetBuilder

NewStatefulSetBuilder creates a new StatefulSetBuilder with common configuration

func (*StatefulSetBuilder) Build

Build constructs the StatefulSet object combining common and component-specific configurations

func (*StatefulSetBuilder) CreateBaseContainer

func (b *StatefulSetBuilder) CreateBaseContainer(
	containerName string,
	entrypoint string,
	ports []corev1.ContainerPort,
	resources *commonsv1alpha1.ResourcesSpec,
	livenessProbe *corev1.Probe,
	readinessProbe *corev1.Probe,
) *corev1.Container

CreateBaseContainer creates a basic container with common configuration that BE and FE can extend

func (*StatefulSetBuilder) CreateHttpProbe

func (b *StatefulSetBuilder) CreateHttpProbe(port int32, path string, initialDelay, period int32) *corev1.Probe

CreateHttpProbe creates an HTTP probe for health checking

func (*StatefulSetBuilder) CreateTcpProbe

func (b *StatefulSetBuilder) CreateTcpProbe(port int32, initialDelay, period int32) *corev1.Probe

CreateTcpProbe creates a TCP probe for health checking

func (*StatefulSetBuilder) GetObject

func (b *StatefulSetBuilder) GetObject() (*appv1.StatefulSet, error)

GetObject returns the StatefulSet object

func (*StatefulSetBuilder) GetRoleGroupInfo

func (b *StatefulSetBuilder) GetRoleGroupInfo() *reconciler.RoleGroupInfo

GetRoleGroupInfo returns the roleGroupInfo

type StatefulSetComponentBuilder

type StatefulSetComponentBuilder interface {
	// GetMainContainer returns the main container for the component
	GetMainContainer() *corev1.Container
	// GetInitContainers returns any init containers required by the component
	GetInitContainers() []corev1.Container
	// GetVolumes returns component-specific volumes
	GetVolumes() []corev1.Volume
	// GetVolumeClaimTemplates returns PVCs for the component
	GetVolumeClaimTemplates() []corev1.PersistentVolumeClaim
	// GetAdditionalEnvVars returns component-specific environment variables
	GetAdditionalEnvVars() []corev1.EnvVar
}

StatefulSetComponentBuilder defines methods that should be implemented by BE/FE specific builders

type VectorConfigParams

type VectorConfigParams struct {
	Client        client.Client
	ClusterConfig *dorisv1alpha1.ClusterConfigSpec
	Namespace     string
	InstanceName  string
	Role          string
	GroupName     string
}

Jump to

Keyboard shortcuts

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