common

package
v1.1.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: AGPL-3.0 Imports: 26 Imported by: 1

Documentation

Overview

Package common provides types and utils shared by all KubeBlocks components: KubeBlocks Core, KBCLI etc. will promote to pkg/common when stable.

Index

Constants

View Source
const (
	PrometheusScrapeAnnotationPath    = "monitor.kubeblocks.io/path"
	PrometheusScrapeAnnotationPort    = "monitor.kubeblocks.io/port"
	PrometheusScrapeAnnotationScheme  = "monitor.kubeblocks.io/scheme"
	PrometheusScrapeAnnotationEnabled = "monitor.kubeblocks.io/scrape"
)

Variables

This section is empty.

Functions

func ConvertStringToInterfaceBySchemaType added in v0.9.4

func ConvertStringToInterfaceBySchemaType(openAPIV3Schema *apiextensionsv1.JSONSchemaProps, input map[string]string) (map[string]interface{}, error)

func CutString added in v0.8.3

func CutString(str string, length int) string

CutString cuts the string with specified length.

func Expand

func Expand(input string, mapping func(string) string) string

Expand replaces variable references in the input string according to the expansion spec using the given mapping function to resolve the values of variables.

func FromContainerPort added in v0.9.0

func FromContainerPort(exporter Exporter, container *corev1.Container) string

func FromScheme added in v0.9.0

func FromScheme(exporter appsv1.Exporter) string

func FromScrapePath added in v0.9.0

func FromScrapePath(exporter appsv1.Exporter) string

func GeneratePasswordByConfig added in v1.0.1

func GeneratePasswordByConfig(config appsv1.PasswordConfig) (string, error)

func GetFieldRef added in v0.8.0

func GetFieldRef(pod *corev1.Pod, from *corev1.EnvVarSource) (string, error)

GetFieldRef returns the value of the supplied path in the given object

func GetScrapeAnnotations added in v0.9.0

func GetScrapeAnnotations(exporter Exporter, container *corev1.Container) map[string]string

func IsCompactMode added in v0.8.0

func IsCompactMode(annotations map[string]string) bool

IsCompactMode tells whether there is a reconciliation compact mode key in the 'annotations'.

func MappingFuncFor

func MappingFuncFor(context ...map[string]string) func(string) string

MappingFuncFor returns a mapping function for use with Expand that implements the expansion semantics defined in the expansion spec; it returns the input string wrapped in the expansion syntax if no mapping for the input is found.

func SafeAddInt added in v0.8.0

func SafeAddInt(a, b int) int

func ToCamelCase added in v0.8.0

func ToCamelCase(input string) string

ToCamelCase transforms k8s resource Name with camel case, for examples: - make-food to MakeFood - make.food to MakeFood

func ValidateDataWithSchema added in v0.8.0

func ValidateDataWithSchema(openAPIV3Schema *apiextensionsv1.JSONSchemaProps, data interface{}) error

ValidateDataWithSchema validates if the data is valid with the jsonSchema.

Types

type Exporter added in v0.9.0

type Exporter struct {
	appsv1.Exporter `json:",inline"`
	TargetPort      *intstr.IntOrString `json:"targetPort,omitempty"`
}

Exporter defines the built-in metrics exporter.

Jump to

Keyboard shortcuts

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