common

package
v0.0.0-...-c3f5ad8 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const Alerter util.Role = "alert"
View Source
const Api util.Role = "api"
View Source
const ContainerVector = "vector"
View Source
const (
	DefaultServerGrace = 120
)
View Source
const Master util.Role = "master"
View Source
const Worker util.Role = "worker"

Variables

This section is empty.

Functions

func ClusterServiceName

func ClusterServiceName(instanceName string) string

func CreateDeploymentReconciler

func CreateDeploymentReconciler(
	contanerBuilder *ContainerBuilder,
	ctx context.Context,
	client *client.Client,
	image *opgoutil.Image,
	replicas *int32,
	clusterOperation *commonsv1alpha1.ClusterOperationSpec,
	roleGroupInfo *reconciler.RoleGroupInfo,
	overrides *commonsv1alpha1.OverridesSpec,
	roleGroupConfig *commonsv1alpha1.RoleGroupConfigSpec,
	zkConfigMapName string,
	volumes []corev1.Volume) reconciler.ResourceReconciler[builder.DeploymentBuilder]

func CreateDnsDomain

func CreateDnsDomain(svcName, namespace, clusterDomain string, port int32) string

func CreateDomainHost

func CreateDomainHost(svcName, namespace, clusterDomain string) string

func CreateKvContentByReplicas

func CreateKvContentByReplicas(replicas int32, keyTemplate string, valueTemplate string) [][2]string

func CreateNetworkUrl

func CreateNetworkUrl(podName string, svcName, namespace, clusterDomain string, port int32) string

func CreatePodNamesByReplicas

func CreatePodNamesByReplicas(replicas int32, statefulResourceName string) []string

CreatePodNamesByReplicas create pod names by replicas

func CreateStatefulSetReconciler

func CreateStatefulSetReconciler(
	containerBuilder *ContainerBuilder,
	ctx context.Context,
	client *client.Client,
	image *opgoutil.Image,
	replicas *int32,
	clusterOperation *commonsv1alpha1.ClusterOperationSpec,
	roleGroupInfo *reconciler.RoleGroupInfo,
	overrides *commonsv1alpha1.OverridesSpec,
	roleGroupConfig *commonsv1alpha1.RoleGroupConfigSpec,
	zkConfigMapName string,
	pvcName string) reconciler.ResourceReconciler[builder.StatefulSetBuilder]

func DeploymentName

func DeploymentName(roleGroupInfo *reconciler.RoleGroupInfo) string

func ExtendConfigMapDataByVector

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

func ExtendWorkloadByVector

func ExtendWorkloadByVector(
	image *util.Image,
	workloadObject ctrlclient.Object,
	vectorConfigMapName string)

func FixExecPermission

func FixExecPermission(role string) string

func IsVectorEnable

func IsVectorEnable(loggingConfig *commonsv1alpha1.LoggingSpec) bool

func NewDeploymentReconciler

func NewDeploymentReconciler(
	ctx context.Context,
	client *client.Client,
	stopped bool,
	image *util.Image,
	replicas *int32,
	roleGroupInfo *reconciler.RoleGroupInfo,
	overrides *commonsv1alpha1.OverridesSpec,
	roleGroupConfig *commonsv1alpha1.RoleGroupConfigSpec,
	containers []corev1.Container,
	volumes []corev1.Volume) reconciler.ResourceReconciler[builder.DeploymentBuilder]

func NewServiceBuilder

func NewServiceBuilder(client *client.Client, name string, headless bool, serviceType *corev1.ServiceType,
	portMap map[string]int32, lables map[string]string, annotations map[string]string) builder.ServiceBuilder

func NewServiceReconciler

func NewServiceReconciler(
	cli *client.Client,
	name string,
	headless bool,
	serviceType *corev1.ServiceType,
	ports map[string]int32, labels, annotations map[string]string) *reconciler.Service

func NewStatefulSetReconciler

func NewStatefulSetReconciler(
	ctx context.Context,
	client *client.Client,
	stopped bool,
	image *util.Image,
	replicas *int32,
	roleGroupInfo *reconciler.RoleGroupInfo,
	overrides *commonsv1alpha1.OverridesSpec,
	roleGroupConfig *commonsv1alpha1.RoleGroupConfigSpec,
	containers []corev1.Container,
	pvcName string,
	storageSize *resource.Quantity) reconciler.ResourceReconciler[builder.StatefulSetBuilder]

func PodFQDN

func PodFQDN(podName, svcName, namespace string) string

func RoleBinBaseDir

func RoleBinBaseDir(role util.Role) string

func RoleBindName

func RoleBindName(instanceName string) string

func RoleConfigPath

func RoleConfigPath(role util.Role, configFileName string) string

func RoleExecArgs

func RoleExecArgs(role string) string

func RoleGroupConfigMapName

func RoleGroupConfigMapName(roleGroupInfo *reconciler.RoleGroupInfo) string

func RoleGroupEnvsConfigMapName

func RoleGroupEnvsConfigMapName(instanceName string) string

func RoleGroupServiceName

func RoleGroupServiceName(roleGroupInfo *reconciler.RoleGroupInfo) string

func RoleName

func RoleName(instanceName string) string

func RoleServer

func RoleServer(role util.Role) string

func ServiceAccountName

func ServiceAccountName(instanceName string) string

func StatefulsetName

func StatefulsetName(roleGroupInfo *reconciler.RoleGroupInfo) string

func ToContainerPortInt32

func ToContainerPortInt32(n interface{}) (int32Port int32, err error)

Types

type CommonPropertiesGenerator

type CommonPropertiesGenerator struct {
	// contains filtered or unexported fields
}

func (*CommonPropertiesGenerator) FileName

func (c *CommonPropertiesGenerator) FileName() string

FileName implements config.FileContentGenerator.

func (*CommonPropertiesGenerator) Generate

Generate implements config.FileContentGenerator.

type ContainerBuilder

type ContainerBuilder struct {
	*builder.Container
	ZookeeperConfigMapName string
	RoleGroupInfo          *reconciler.RoleGroupInfo
	RoleGroupConfig        *commonsv1alpha1.RoleGroupConfigSpec
	// contains filtered or unexported fields
}

func NewContainerBuilder

func NewContainerBuilder(
	contaienr util.ContainerComponent,
	image *opgoutil.Image,
	zookeeperConfigMapName string,
	roleGroupInfo *reconciler.RoleGroupInfo,
	roleGroupConfig *commonsv1alpha1.RoleGroupConfigSpec,
) *ContainerBuilder

func (*ContainerBuilder) AddEnvFromSecret

func (c *ContainerBuilder) AddEnvFromSecret(secretName string, envToSecretKeymap map[string]string) *ContainerBuilder

env map from secret

func (*ContainerBuilder) Build

func (c *ContainerBuilder) Build() *corev1.Container

build container

func (*ContainerBuilder) CommonCommandArgs

func (c *ContainerBuilder) CommonCommandArgs() *ContainerBuilder

with command args

func (*ContainerBuilder) GetCommandArgs

func (c *ContainerBuilder) GetCommandArgs() []string

get command args

func (*ContainerBuilder) ResetCommandArgs

func (c *ContainerBuilder) ResetCommandArgs(script string) *ContainerBuilder

reset command args

func (*ContainerBuilder) ResetVolumeMounts

func (c *ContainerBuilder) ResetVolumeMounts() *ContainerBuilder

reset volume mounts

func (*ContainerBuilder) WithEnvs

func (c *ContainerBuilder) WithEnvs(envMap util.SortedMap) *ContainerBuilder

with envs key is env name, value is env value

func (*ContainerBuilder) WithPorts

func (c *ContainerBuilder) WithPorts(portMap util.SortedMap) *ContainerBuilder

with ports key is port name, value is port

func (*ContainerBuilder) WithReadinessAndLivenessProbe

func (c *ContainerBuilder) WithReadinessAndLivenessProbe(port int) *ContainerBuilder

with readiness probe and liveness probe port is service port

func (*ContainerBuilder) WithSecretEnvFrom

func (c *ContainerBuilder) WithSecretEnvFrom(secretName string) *ContainerBuilder

with secret env from key is envfrom name, value is envfrom value

func (*ContainerBuilder) WithVolumeMounts

func (c *ContainerBuilder) WithVolumeMounts(vmMap util.SortedMap) *ContainerBuilder

with volume mounts key is volume name, value is mount path

type DeploymentBuilder

type DeploymentBuilder struct {
	*builder.Deployment
	*WorkloadBuilder
}

func (*DeploymentBuilder) Build

type DolphinSchedulerConfig

type DolphinSchedulerConfig struct {
	// contains filtered or unexported fields
}

func DefaultConfig

func DefaultConfig(role util.Role, crName string) *DolphinSchedulerConfig

func (*DolphinSchedulerConfig) ComputeCli

func (c *DolphinSchedulerConfig) ComputeCli() (map[string]string, error)

ComputeClient implements config.Configuration.

func (*DolphinSchedulerConfig) ComputeEnv

func (c *DolphinSchedulerConfig) ComputeEnv() (map[string]string, error)

ComputeEnv implements config.Configuration.

func (*DolphinSchedulerConfig) ComputeFile

func (c *DolphinSchedulerConfig) ComputeFile() (map[string]interface{}, error)

ComputeFile implements config.Configuration.

func (*DolphinSchedulerConfig) MergeDefaultConfig

func (c *DolphinSchedulerConfig) MergeDefaultConfig(
	overrides *commonsv1alpha1.OverridesSpec,
	mergedCfg *dolphinv1alpha1.ConfigSpec,
) error

merge defaultConfig

type EnvConfigmapDataGenerator

type EnvConfigmapDataGenerator struct {
	// contains filtered or unexported fields
}

func (*EnvConfigmapDataGenerator) Generate

func (e *EnvConfigmapDataGenerator) Generate(ctx context.Context) (envs map[string]string, err error)

Generate implements config.EnvGenerator.

type GeneralNodeConfig

type GeneralNodeConfig struct {
	Affinity *corev1.Affinity
	// contains filtered or unexported fields
}

func (*GeneralNodeConfig) GetgracefulShutdownTimeoutSeconds

func (G *GeneralNodeConfig) GetgracefulShutdownTimeoutSeconds() *string

type LogbackConfig

type LogbackConfig struct {
	// contains filtered or unexported fields
}

LogbackConfig is a struct that contains logback logging configuration

func NewConfigGenerator

func NewConfigGenerator(
	loggingConfigSpec *loggingv1alpha1.LoggingConfigSpec,
	containerName string,
	logFileName string,
	logType productlogging.LogType,
	opts ...productlogging.ConfigGeneratorOptionFunc,
) (*LogbackConfig, error)

func (*LogbackConfig) Content

func (l *LogbackConfig) Content() (string, error)

Content implements the LoggingConfig interface

func (*LogbackConfig) LoggerFormatter

func (l *LogbackConfig) LoggerFormatter(name string, level string) string

LoggerFormatter implements the LoggingConfig interface

func (*LogbackConfig) String

func (l *LogbackConfig) String() string

String implements the LoggingConfig interface

func (*LogbackConfig) Template

func (l *LogbackConfig) Template() string

Template implements the LoggingConfig interface

type LogbackXmlGenerator

type LogbackXmlGenerator struct {
	// contains filtered or unexported fields
}

func (*LogbackXmlGenerator) FileName

func (l *LogbackXmlGenerator) FileName() string

FileName implements config.FileContentGenerator.

func (*LogbackXmlGenerator) Generate

func (l *LogbackXmlGenerator) Generate(ctx context.Context) (string, error)

Generate implements config.FileContentGenerator.

type RoleReconciler

type RoleReconciler struct {
	reconciler.BaseRoleReconciler[dolphinv1alpha1.RoleSpec]
	ClusterConfig *dolphinv1alpha1.ClusterConfigSpec
	Image         *opgoutil.Image
	// contains filtered or unexported fields
}

func NewRoleReconciler

func NewRoleReconciler(
	client *client.Client,
	roleInfo reconciler.RoleInfo,
	clusterOperation *commonsv1alpha1.ClusterOperationSpec,
	clusterConfig *dolphinv1alpha1.ClusterConfigSpec,
	image *opgoutil.Image,
	spec dolphinv1alpha1.RoleSpec,
	roleResourceReconcilersBuilder RoleResourceReconcilersBuilder,
) *RoleReconciler

func (*RoleReconciler) RegisterResourceWithRoleGroup

func (r *RoleReconciler) RegisterResourceWithRoleGroup(
	ctx context.Context,
	replicas *int32,
	info *reconciler.RoleGroupInfo,
	overrides *commonsv1alpha1.OverridesSpec,
	roleGroupConfig *commonsv1alpha1.RoleGroupConfigSpec,
) ([]reconciler.Reconciler, error)

func (*RoleReconciler) RegisterResources

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

type RoleResourceReconcilersBuilder

type RoleResourceReconcilersBuilder interface {
	ResourceReconcilers(
		ctx context.Context,
		replicas *int32,
		info *reconciler.RoleGroupInfo,
		overrides *commonsv1alpha1.OverridesSpec,
		roleGroupConfig *commonsv1alpha1.RoleGroupConfigSpec,
	) []reconciler.Reconciler
}

type StatefulSetBuilder

type StatefulSetBuilder struct {
	*builder.StatefulSet
	*WorkloadBuilder
}

statefulset builder

func (*StatefulSetBuilder) Build

type VectorConfigParams

type VectorConfigParams struct {
	Client        ctrlclient.Client
	ClusterConfig *v1alpha1.ClusterConfigSpec
	Namespace     string
	InstanceName  string
	Role          string
	GroupName     string
}

type WorkloadBuilder

type WorkloadBuilder struct {
	RoleGroupInf    *reconciler.RoleGroupInfo
	Containers      []corev1.Container
	RoleGroupConfig *commonsv1alpha1.RoleGroupConfigSpec
	// contains filtered or unexported fields
}

workload builder

func NewWorkloadBuilder

func NewWorkloadBuilder(
	roleGroupConfig *commonsv1alpha1.RoleGroupConfigSpec,
	rolegroupInfo *reconciler.RoleGroupInfo,
	containers []corev1.Container) *WorkloadBuilder

func (*WorkloadBuilder) ExtractAffinity

func (w *WorkloadBuilder) ExtractAffinity() (*corev1.Affinity, error)

set Affinity

func (*WorkloadBuilder) GetPvcTemplates

func (w *WorkloadBuilder) GetPvcTemplates() []corev1.PersistentVolumeClaim

get pvc templates

func (*WorkloadBuilder) VectorDecorator

func (w *WorkloadBuilder) VectorDecorator(workloadObject ctrlclient.Object, image *util.Image)

decoraate vector

func (*WorkloadBuilder) WithPvcTemplates

func (w *WorkloadBuilder) WithPvcTemplates(pvcName string, storageSize resource.Quantity) *WorkloadBuilder

with pvc templates

func (*WorkloadBuilder) WithVolumes

func (w *WorkloadBuilder) WithVolumes(volumes []corev1.Volume)

with volumes

Jump to

Keyboard shortcuts

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