resource_utils

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: Apache-2.0 Imports: 17 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            = "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

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

the fe proxy ports key

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,
	HEARTBEAT_SERVICE_PORT: 9050,
	BRPC_PORT:              8060,
}

DefMap the default port about abilities.

Functions

func BuildExternalService

func BuildExternalService(src *srapi.StarRocksCluster, name string, serviceType StarRocksServiceType,
	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) 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(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 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(nsvc, oldsvc *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
}

type StarRocksServiceType

type StarRocksServiceType string
const (
	FeService      StarRocksServiceType = "fe"
	BeService      StarRocksServiceType = "be"
	CnService      StarRocksServiceType = "cn"
	FeProxyService StarRocksServiceType = "fe-proxy"
)

Jump to

Keyboard shortcuts

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