k8s

package
v2.2.0-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelKeyK8sAppName          = "app.kubernetes.io/name"
	LabelValK8sAppNameTiDB      = "tidb-cluster"
	LabelValK8sAppNameDMCluster = "dm-cluster"
)
View Source
const FailedCreatePodReason = "FailedCreate"

Variables

View Source
var RateLimiter = workqueue.NewTypedMaxOfRateLimiter[ctrl.Request](
	workqueue.NewTypedItemExponentialFailureRateLimiter[ctrl.Request](controllerInitDelay, controllerMaxInterval),
)

Functions

func AnnoAdditionalProm

func AnnoAdditionalProm(name string, port int32) map[string]string

AnnoAdditionalProm returns the additional prometheus annotations for a pod. Some pods may have multiple prometheus endpoints. We assume the same path is used for all endpoints.

func AnnoProm

func AnnoProm(port int32, path string) map[string]string

AnnoProm returns the prometheus annotations for a pod.

func DeleteGroupSubresource

func DeleteGroupSubresource[G runtime.Group](
	ctx context.Context,
	c client.Client,
	group G,
	objs client.ObjectList,
	opts ...client.DeleteOption,
) (wait bool, _ error)

func DeleteInstanceSubresource

func DeleteInstanceSubresource[I runtime.Instance](
	ctx context.Context,
	c client.Client,
	instance I,
	objs client.ObjectList,
	opts ...client.DeleteOption,
) (wait bool, _ error)

DeleteInstanceSubresource try to delete a subresource of an instance, e.g. pods, cms, pvcs

func EnsureGroupSubResourceDeleted

func EnsureGroupSubResourceDeleted(ctx context.Context, cli client.Client,
	namespace, name string, _ ...client.DeleteOption,
) error

EnsureGroupSubResourceDeleted ensures the sub resources of a group are deleted. It only deletes the service of the group currently.

func GetNodeLabelsForKeys

func GetNodeLabelsForKeys(node *corev1.Node, keys []string) map[string]string

GetNodeLabelsForKeys gets the labels of the node for the specified keys. This function is used to get the labels for setting store & server labels.

func LabelsK8sApp

func LabelsK8sApp(cluster, component string) map[string]string

LabelsK8sApp returns some labels with "app.kubernetes.io" prefix. NOTE: these labels are deprecated, and they are used for TiDB Operator v1 compatibility. If you are developing a new feature, please use labels with "pingcap.com" prefix instead.

func NewEventRecorder

func NewEventRecorder(kubeCli kubernetes.Interface, source string) record.EventRecorder

NewEventRecorder return the specify source's recoder

func RecordFailedCreatePod

func RecordFailedCreatePod(recorders []record.EventRecorder, object runtime.Object, err error)

RecordFailedCreatePod records a warning event on the owner object when a Pod create request fails, matching the reason/message style used by Kubernetes built-in workload controllers.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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