resource_utils

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_PORT     = "http_port"
	RPC_PORT      = "rpc_port"
	QUERY_PORT    = "query_port"
	EDIT_LOG_PORT = "edit_log_port"
)

the fe ports key

View Source
const (
	// THRIFT_PORT is the old name in CN.
	// From StarRocks 3.1, both CN and BE use the same port name be_port.
	THRIFT_PORT = "thrift_port"
	BE_PORT     = "be_port"

	// WEBSERVER_PORT and BE_HTTP_PORT
	// From StarRocks 3.0, the name of HTTP port is changed to be_http_port in BE and CN.
	WEBSERVER_PORT = "webserver_port"
	BE_HTTP_PORT   = "be_http_port"

	// HEARTBEAT_SERVICE_PORT and BRPC_PORT
	// both BE and CN have the these ports
	HEARTBEAT_SERVICE_PORT = "heartbeat_service_port"
	BRPC_PORT              = "brpc_port"
)

the cn or be ports key

View Source
const (
	FE_PROXY_HTTP_PORT      = 8080
	FE_PORXY_HTTP_PORT_NAME = "http-port"
)

the fe proxy ports key

View Source
const (
	FeHTTPPortName    = "http"
	FeRPCPortName     = "rpc"
	FeQueryPortName   = "query"
	FeEditLogPortName = "edit-log"

	BePortName          = "be"
	BeWebserverPortName = "webserver"
	BeHeartbeatPortName = "heartbeat"
	BeBrpcPortName      = "brpc"

	CnThriftPortName    = "thrift"
	CnWebserverPortName = "webserver"
	CnHeartbeatPortName = "heartbeat"
	CnBrpcPortName      = "brpc"
)

Variables

View Source
var (
	AutoscalerKind  = "HorizontalPodAutoscaler"
	StatefulSetKind = "StatefulSet"
	ServiceKind     = "Service"
)
View Source
var DefMap = map[string]int32{
	HTTP_PORT:              8030,
	RPC_PORT:               9020,
	QUERY_PORT:             9030,
	EDIT_LOG_PORT:          9010,
	THRIFT_PORT:            9060,
	BE_PORT:                9060,
	WEBSERVER_PORT:         8040,
	BE_HTTP_PORT:           8040,
	HEARTBEAT_SERVICE_PORT: 9050,
	BRPC_PORT:              8060,
}

DefMap the default port about abilities.

Functions

func BuildExternalService

func BuildExternalService(object object.StarRocksObject, spec srapi.SpecInterface,
	config map[string]interface{}, selector map[string]string, labels map[string]string) corev1.Service

BuildExternalService build the external service. not have selector

func BuildHorizontalPodAutoscaler

func BuildHorizontalPodAutoscaler(pap *PodAutoscalerParams, autoScalerVersion srapi.AutoScalerVersion) client.Object

func GetInt32Pointer

func GetInt32Pointer(v int32) *int32

func GetInt64ptr

func GetInt64ptr(n int64) *int64

func GetPort

func GetPort(config map[string]interface{}, key string) int32

GetPort get ports from config file.

func GetStringPointer

func GetStringPointer(s string) *string

func HaveEqualOwnerReference

func HaveEqualOwnerReference(svc1 *corev1.Service, svc2 *corev1.Service) bool

func MergeMetadata

func MergeMetadata(newMeta *metav1.ObjectMeta, oldMeta 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 MergeSlices(new []string, old []string) []string

func MergeStatefulSets

func MergeStatefulSets(new *appv1.StatefulSet, old appv1.StatefulSet)

MergeStatefulSets merge exist statefulset and new statefulset.

func ResolveConfigMap

func ResolveConfigMap(configMap *corev1.ConfigMap, key string) (map[string]interface{}, error)

func ServiceDeepEqual

func ServiceDeepEqual(expectSvc, actualSvc *corev1.Service) bool

func StatefulSetDeepEqual

func StatefulSetDeepEqual(new *appv1.StatefulSet, old *appv1.StatefulSet, excludeReplicas bool) bool

StatefulSetDeepEqual judge two statefulset equal or not.

Types

type Annotations

type Annotations map[string]string

func (Annotations) Add

func (a Annotations) Add(key, value string)

func (Annotations) AddAnnotation

func (a Annotations) AddAnnotation(annotation Annotations)

type Labels

type Labels map[string]string

func (Labels) Add

func (l Labels) Add(key, value string)

func (Labels) AddLabel

func (l Labels) AddLabel(label Labels)

type PodAutoscalerParams

type PodAutoscalerParams struct {
	AutoscalerType  srapi.AutoScalerVersion
	Namespace       string
	Name            string
	Labels          Labels
	TargetName      string
	OwnerReferences []metav1.OwnerReference
	ScalerPolicy    *srapi.AutoScalingPolicy
}

Jump to

Keyboard shortcuts

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