util

package
v1.7.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LabelNodeRoleMaster specifies that a node is a master
	LabelNodeRoleMaster = "node-role.kubernetes.io/master"
)

Variables

View Source
var ExecutableFileExtensions = []string{""}

Valid file extensions for plugin executables.

Functions

func EnsureDirectoryExist

func EnsureDirectoryExist(dirName string) error

EnsureDirectoryExist create directory if does not exist

func FindInPath

func FindInPath(binary string, paths []string) (string, error)

FindInPath returns the full path of the binary by searching in the provided path

func GenURL

func GenURL(url string) string

GenURL adds 'http' prefix for URL

func GetContainerStatusFromPod

func GetContainerStatusFromPod(pod *corev1.Pod, cond func(corev1.ContainerStatus) bool) *corev1.ContainerStatus

func GetHostname

func GetHostname(hostnameOverride string) (string, error)

GetHostname returns OS's hostname if 'hostnameOverride' is empty; otherwise, return 'hostnameOverride'.

func ListK8sNodes

func ListK8sNodes(kubectlPath, labels string) ([]string, error)

ListK8sNodes returns k8s nodes base on node labels

func OpenDB

func OpenDB(dsn string, maxIdleConns int) (*sql.DB, error)

OpenDB opens db

func ShowMasterCommitTS added in v1.1.0

func ShowMasterCommitTS(dsn string) (int64, error)

Show master commit ts of TiDB

func Sleep

func Sleep(ctx context.Context, sleepTime time.Duration)

Sleep defines special `sleep` with context

Types

This section is empty.

Jump to

Keyboard shortcuts

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