Documentation
¶
Overview ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func ApplySecurityContext(containers []corev1.Container, securityContext *corev1.SecurityContext) []corev1.Container
- func BuildDisaggregatedPVC(pvcTemplate corev1.PersistentVolumeClaim, labels map[string]string, ...) corev1.PersistentVolumeClaim
- func BuildDisaggregatedProbe(container *corev1.Container, cs *dv1.CommonSpec, ...)
- func BuildExternalService(dcr *v1.DorisCluster, componentType v1.ComponentType, ...) corev1.Service
- func BuildHorizontalPodAutoscaler(pap *PodAutoscalerParams) client.Object
- func BuildInternalService(dcr *v1.DorisCluster, componentType v1.ComponentType, ...) corev1.Service
- func BuildKerberosEnvForDDC(info *dv1.KerberosInfo, config map[string]interface{}, ...) []corev1.EnvVar
- func BuildPVC(volume dorisv1.PersistentVolume, labels map[string]string, ...) corev1.PersistentVolumeClaim
- func BuildPVCName(stsName, ordinal, volumeName string) string
- func BuildSharedVolumesAndVolumeMounts(spvcs []v1.SharedPersistentVolumeClaim, componentType v1.ComponentType) ([]corev1.Volume, []corev1.VolumeMount, []string)
- func GenerateEveryoneMountPathDorisPersistentVolume(spec *dorisv1.BaseSpec, excludePaths []string, config map[string]interface{}, ...) ([]dorisv1.PersistentVolume, error)
- func GeneratePodTemplateName(dcr *v1.DorisCluster, componentType v1.ComponentType) string
- func GetContainerPorts(config map[string]interface{}, componentType v1.ComponentType) []corev1.ContainerPort
- func GetDefaultPort(key string) int32
- func GetDisaggregatedContainerPorts(config map[string]interface{}, componentType dv1.DisaggregatedComponentType) []corev1.ContainerPort
- func GetDorisCoreConfigMapNames(dcr *dorisv1.DorisCluster) map[dorisv1.ComponentType]string
- func GetDorisLoginInformation(secret *corev1.Secret) (adminUserName, password string)
- func GetDv1KerberosVolumeAndVolumeMount(kerberosInfo *dv1.KerberosInfo) ([]corev1.Volume, []corev1.VolumeMount)
- func GetInt32Pointer(v int32) *int32
- func GetMountConfigMapInfo(c dorisv1.ConfigMapInfo) (finalConfigMaps []dorisv1.MountConfigMapInfo)
- func GetMultiSecretVolumeAndVolumeMountWithCommonSpec(cSpec *dv1.CommonSpec) ([]corev1.Volume, []corev1.VolumeMount)
- func GetOwnerReference(o client.Object) metav1.OwnerReference
- func GetPodDefaultEnv() []corev1.EnvVar
- func GetPodInfoVolumesVolumeMounts() ([]corev1.Volume, []corev1.VolumeMount)
- func GetPort(config map[string]interface{}, key string) int32
- func GetPortKey(configKey string) string
- func GetStartMode(config map[string]interface{}) string
- func GetString(config map[string]interface{}, key string) string
- func GetTerminationGracePeriodSeconds(config map[string]interface{}) int64
- func LifeCycleWithPreStopScript(lc *corev1.Lifecycle, preStopScript string) *corev1.Lifecycle
- func LivenessProbe(port, timeout int32, path string, commands []string, pt ProbeType) *corev1.Probe
- func MergeMetadata(new *metav1.ObjectMeta, old metav1.ObjectMeta)
- func MergeSlices(new []string, old []string) []string
- func MergeStatefulSets(new *appv1.StatefulSet, old appv1.StatefulSet)
- func NewBaseMainContainer(dcr *v1.DorisCluster, config map[string]interface{}, ...) corev1.Container
- func NewContainerWithCommonSpec(cs *dv1.CommonSpec) corev1.Container
- func NewPodTemplateSpec(dcr *v1.DorisCluster, config map[string]interface{}, ...) corev1.PodTemplateSpec
- func NewPodTemplateSpecWithCommonSpec(skipDefaultInit bool, cs *dv1.CommonSpec, ...) corev1.PodTemplateSpec
- func NewStatefulSet(dcr *v1.DorisCluster, config map[string]interface{}, ...) appv1.StatefulSet
- func ReadinessProbe(port int32, path string, commands []string, pt ProbeType) *corev1.Probe
- func ResolveConfigMaps(configMaps []*corev1.ConfigMap, componentType dorisv1.ComponentType) (map[string]interface{}, error)
- func ServiceDeepEqual(newSvc, oldSvc *corev1.Service) bool
- func ServiceDeepEqualWithAnnoKey(nsvc, osvc *corev1.Service, annoKey string) bool
- func StatefulSetDeepEqual(new *appv1.StatefulSet, old *appv1.StatefulSet, excludeReplicas bool) bool
- func StatefulsetDeepEqualWithKey(new, old *appv1.StatefulSet, annoKey string, excludeReplicas bool) bool
- func UseNewDefaultInitContainerImage(pts *corev1.PodTemplateSpec)
- type Annotations
- type DecommissionPhase
- type DecommissionTaskStatus
- type Labels
- type PodAutoscalerParams
- type ProbeType
Constants ¶
const ( HTTP_PORT = "http_port" RPC_PORT = "rpc_port" QUERY_PORT = "query_port" EDIT_LOG_PORT = "edit_log_port" )
the fe ports key
const ( THRIFT_PORT = "thrift_port" BE_PORT = "be_port" WEBSERVER_PORT = "webserver_port" HEARTBEAT_SERVICE_PORT = "heartbeat_service_port" BRPC_PORT = "brpc_port" )
the cn or be ports key
const ( FE_RESOLVEKEY = "fe.conf" BE_RESOLVEKEY = "be.conf" CN_RESOLVEKEY = "be.conf" BROKER_RESOLVEKEY = "apache_hdfs_broker.conf" MS_RESOLVEKEY = "doris_cloud.conf" DefaultMsToken = "greedisgood9999" DefaultMsTokenKey = "http_token" ENABLE_TLS_KEY = "enable_tls" TLS_CERTIFICATE_PATH_KEY = "tls_certificate_path" TLS_PRIVATE_KEY_PATH_KEY = "tls_private_key_path" TLS_CA_CERTIFICATE_PATH_KEY = "tls_ca_certificate_path" )
the default ResolveKey
const ( ENV_FE_ADDR = "ENV_FE_ADDR" ENV_FE_PORT = "FE_QUERY_PORT" ENABLE_WORKLOAD_GROUP = "ENABLE_WORKLOAD_GROUP" ENV_FE_ELECT_NUMBER = "ELECT_NUMBER" COMPONENT_TYPE = "COMPONENT_TYPE" FDB_ENDPOINT = "FDB_ENDPOINT" NAMESPACE = "NAMESPACE" STATEFULSET_NAME = "STATEFULSET_NAME" COMPUTE_GROUP_NAME = "COMPUTE_GROUP_NAME" )
the env keys
const ( ConfigEnvPath = config_env_path HEALTH_API_PATH = "/api/health" HEALTH_BROKER_LIVE_COMMAND = "/opt/apache-doris/broker_is_alive.sh" FE_PRESTOP = "/opt/apache-doris/fe_prestop.sh" BE_PRESTOP = "/opt/apache-doris/be_prestop.sh" BROKER_PRESTOP = "/opt/apache-doris/broker_prestop.sh" //keys for pod env variables POD_NAME = "POD_NAME" POD_IP = "POD_IP" HOST_IP = "HOST_IP" POD_NAMESPACE = "POD_NAMESPACE" ADMIN_USER = "USER" ADMIN_PASSWD = "PASSWD" DORIS_ROOT_KEY = "DORIS_ROOT" KRB5_MOUNT_PATH = "KRB5_MOUNT_PATH" KRB5_CONFIG = "KRB5_CONFIG" KEYTAB_MOUNT_PATH = "KEYTAB_MOUNT_PATH" KEYTAB_FINAL_USED_PATH = "KEYTAB_FINAL_USED_PATH" DEFAULT_ADMIN_USER = "root" DEFAULT_ROOT_PATH = "/opt/apache-doris" POD_INFO_PATH = "/etc/podinfo" POD_INFO_VOLUME_NAME = "podinfo" NODE_TOPOLOGYKEY = "kubernetes.io/hostname" DEFAULT_INIT_IMAGE = "selectdb/alpine:latest" HEALTH_DISAGGREGATED_FE_PROBE_COMMAND = "/opt/apache-doris/fe_disaggregated_probe.sh" HEALTH_DISAGGREGATED_BE_PROBE_COMMAND = "/opt/apache-doris/be_disaggregated_probe.sh" HEALTH_DISAGGREGATED_MS_PROBE_COMMAND = "/opt/apache-doris/ms_disaggregated_probe.sh" DISAGGREGATED_LIVE_PARAM_ALIVE = "alive" DISAGGREGATED_LIVE_PARAM_READY = "ready" POD_CONTROLLER_REVISION_HASH_KEY = "controller-revision-hash" DISAGGREGATED_FE_MAIN_CONTAINER_NAME = "fe" DISAGGREGATED_BE_MAIN_CONTAINER_NAME = "compute" DISAGGREGATED_MS_MAIN_CONTAINER_NAME = "metaservice" )
const ARROW_FLIGHT_SQL_PORT = "arrow_flight_sql_port"
const BROKER_IPC_PORT = "broker_ipc_port"
const BRPC_LISTEN_PORT = "brpc_listen_port"
const ENABLE_FQDN = "enable_fqdn_mode"
const GRACE_SHUTDOWN_WAIT_SECONDS = "grace_shutdown_wait_seconds"
const (
PVCManagerAnnotationApache = "apache.doris.org/pvc-manager"
)
const START_MODEL_FQDN = "FQDN"
const START_MODEL_IP = "IP"
Variables ¶
var ( AutoscalerKind = "HorizontalPodAutoscaler" StatefulSetKind = "StatefulSet" ServiceKind = "Service" )
Functions ¶
func ApplySecurityContext ¶
func ApplySecurityContext(containers []corev1.Container, securityContext *corev1.SecurityContext) []corev1.Container
ApplySecurityContext applies the container security context to all containers in the pod (if not already set).
func BuildDisaggregatedPVC ¶
func BuildDisaggregatedPVC( pvcTemplate corev1.PersistentVolumeClaim, labels map[string]string, namespace, stsName, ordinal string) corev1.PersistentVolumeClaim
func BuildDisaggregatedProbe ¶
func BuildDisaggregatedProbe(container *corev1.Container, cs *dv1.CommonSpec, componentType dv1.DisaggregatedComponentType)
func BuildExternalService ¶
func BuildExternalService(dcr *v1.DorisCluster, componentType v1.ComponentType, config map[string]interface{}) corev1.Service
BuildExternalService build the external service. not have selector
func BuildHorizontalPodAutoscaler ¶
func BuildHorizontalPodAutoscaler(pap *PodAutoscalerParams) client.Object
func BuildInternalService ¶
func BuildInternalService(dcr *v1.DorisCluster, componentType v1.ComponentType, config map[string]interface{}) corev1.Service
func BuildKerberosEnvForDDC ¶
func BuildKerberosEnvForDDC(info *dv1.KerberosInfo, config map[string]interface{}, componentType dv1.DisaggregatedComponentType) []corev1.EnvVar
func BuildPVC ¶
func BuildPVC(volume dorisv1.PersistentVolume, labels map[string]string, namespace, stsName, ordinal string) corev1.PersistentVolumeClaim
func BuildPVCName ¶
func BuildSharedVolumesAndVolumeMounts ¶
func BuildSharedVolumesAndVolumeMounts(spvcs []v1.SharedPersistentVolumeClaim, componentType v1.ComponentType) ([]corev1.Volume, []corev1.VolumeMount, []string)
func GenerateEveryoneMountPathDorisPersistentVolume ¶
func GenerateEveryoneMountPathDorisPersistentVolume(spec *dorisv1.BaseSpec, excludePaths []string, config map[string]interface{}, componentType dorisv1.ComponentType) ([]dorisv1.PersistentVolume, error)
GenerateEveryoneMountPathDorisPersistentVolume is used to process the pvc template configuration in CRD. The template is defined as follows: - PersistentVolume.MountPath is "", it`s template configuration. - PersistentVolume.MountPath is not "", it`s actual pvc configuration. The Explain rules are as follows: 1. Non-templated PersistentVolumes are returned directly in the result list. 2. If there is a pvc template, return the actual list of pvcs after processing. 3. The template needs to parse the configuration of the doris config file to create the pvc. 4. If there are multiple templates, the last valid template will be used.
func GeneratePodTemplateName ¶
func GeneratePodTemplateName(dcr *v1.DorisCluster, componentType v1.ComponentType) string
func GetContainerPorts ¶
func GetContainerPorts(config map[string]interface{}, componentType v1.ComponentType) []corev1.ContainerPort
func GetDefaultPort ¶
func GetDisaggregatedContainerPorts ¶
func GetDisaggregatedContainerPorts(config map[string]interface{}, componentType dv1.DisaggregatedComponentType) []corev1.ContainerPort
func GetDorisCoreConfigMapNames ¶
func GetDorisCoreConfigMapNames(dcr *dorisv1.DorisCluster) map[dorisv1.ComponentType]string
func GetDv1KerberosVolumeAndVolumeMount ¶
func GetDv1KerberosVolumeAndVolumeMount(kerberosInfo *dv1.KerberosInfo) ([]corev1.Volume, []corev1.VolumeMount)
get the kerberos volume and mounts to ddc.
func GetInt32Pointer ¶
func GetMountConfigMapInfo ¶
func GetMountConfigMapInfo(c dorisv1.ConfigMapInfo) (finalConfigMaps []dorisv1.MountConfigMapInfo)
func GetMultiSecretVolumeAndVolumeMountWithCommonSpec ¶
func GetMultiSecretVolumeAndVolumeMountWithCommonSpec(cSpec *dv1.CommonSpec) ([]corev1.Volume, []corev1.VolumeMount)
func GetOwnerReference ¶
func GetOwnerReference(o client.Object) metav1.OwnerReference
func GetPodDefaultEnv ¶
GetPodDefaultEnv is currently only used in disaggregated
func GetPodInfoVolumesVolumeMounts ¶
func GetPodInfoVolumesVolumeMounts() ([]corev1.Volume, []corev1.VolumeMount)
func GetPortKey ¶
func GetStartMode ¶
GetStartMode return fe host type, fqdn(host) or ip, from 'fe.conf' enable_fqdn_mode
func GetTerminationGracePeriodSeconds ¶
GetTerminationGracePeriodSeconds get grace_shutdown_wait_seconds from config file.
func LivenessProbe ¶
func MergeMetadata ¶
func MergeMetadata(new *metav1.ObjectMeta, old metav1.ObjectMeta)
mergeMetadata takes labels and annotations from the old resource and merges them into the new resource. If a key is present in both resources, the new resource wins. It also copies the ResourceVersion from the old resource to the new resource to prevent update conflicts.
func MergeSlices ¶
func MergeStatefulSets ¶
func MergeStatefulSets(new *appv1.StatefulSet, old appv1.StatefulSet)
MergeStatefulSets merge exist statefulset and new statefulset.
func NewBaseMainContainer ¶
func NewBaseMainContainer(dcr *v1.DorisCluster, config map[string]interface{}, componentType v1.ComponentType) corev1.Container
func NewContainerWithCommonSpec ¶
func NewContainerWithCommonSpec(cs *dv1.CommonSpec) corev1.Container
build disaggregated node(fe,be) container.
func NewPodTemplateSpec ¶
func NewPodTemplateSpec(dcr *v1.DorisCluster, config map[string]interface{}, componentType v1.ComponentType) corev1.PodTemplateSpec
func NewPodTemplateSpecWithCommonSpec ¶
func NewPodTemplateSpecWithCommonSpec(skipDefaultInit bool, cs *dv1.CommonSpec, componentType dv1.DisaggregatedComponentType) corev1.PodTemplateSpec
for disaggregated cluster.
func NewStatefulSet ¶
func NewStatefulSet(dcr *v1.DorisCluster, config map[string]interface{}, componentType v1.ComponentType) appv1.StatefulSet
NewStatefulSet construct statefulset.
func ReadinessProbe ¶
func ResolveConfigMaps ¶
func ServiceDeepEqual ¶
func StatefulSetDeepEqual ¶
func StatefulSetDeepEqual(new *appv1.StatefulSet, old *appv1.StatefulSet, excludeReplicas bool) bool
StatefulSetDeepEqual judge two statefulset equal or not.
func StatefulsetDeepEqualWithKey ¶
func StatefulsetDeepEqualWithKey(new, old *appv1.StatefulSet, annoKey string, excludeReplicas bool) bool
func UseNewDefaultInitContainerImage ¶
func UseNewDefaultInitContainerImage(pts *corev1.PodTemplateSpec)
the default value has updated, when updated statefulset use new default value.
Types ¶
type Annotations ¶
func BuildDisaggregatedPVCAnnotations ¶
func BuildDisaggregatedPVCAnnotations(volume dv1.PersistentVolume) Annotations
BuildDisaggregatedPVCAnnotations finalAnnotations is a combination of user annotations and operator default annotations
func NewAnnotations ¶
func NewAnnotations(annotations ...Annotations) Annotations
func (Annotations) Add ¶
func (a Annotations) Add(key, value string)
func (Annotations) AddAnnotation ¶
func (a Annotations) AddAnnotation(annotation Annotations)
type DecommissionPhase ¶
type DecommissionPhase string
const ( Decommissioned DecommissionPhase = "Decommissioned" Decommissioning DecommissionPhase = "Decommissioning" DecommissionAcceptable DecommissionPhase = "DecommissionAcceptable" DecommissionPhaseUnknown DecommissionPhase = "Unknown" )
type DecommissionTaskStatus ¶
type DecommissionTaskStatus struct {
AllBackendsSize int
UnDecommissionedCount int
DecommissioningCount int
DecommissionedCount int
BeKeepAmount int
}
func ConstructDecommissionTaskStatus ¶
func ConstructDecommissionTaskStatus(allBackends []*mysql.Backend, cgKeepAmount int32) DecommissionTaskStatus
func (*DecommissionTaskStatus) GetDecommissionPhase ¶
func (d *DecommissionTaskStatus) GetDecommissionPhase() DecommissionPhase
type PodAutoscalerParams ¶
type PodAutoscalerParams struct {
AutoscalerType dorisv1.AutoScalerVersion
Namespace string
Name string
Labels Labels
TargetName string
OwnerReferences []metav1.OwnerReference
ScalerPolicy *dorisv1.AutoScalingPolicy
}