util

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 25 Imported by: 18

Documentation

Index

Constants

View Source
const AUTO_SELECT_PORT_MAX = 30000
View Source
const AUTO_SELECT_PORT_MIN = 20000
View Source
const JobMaxLength int = 49

Job Max lenth should be 49

Variables

This section is empty.

Functions

func AcquireAllPods

func AcquireAllPods(namespace string, client *kubernetes.Clientset) ([]v1.Pod, error)

func AcquireServingServices

func AcquireServingServices(namespace string, client *kubernetes.Clientset) ([]v1.Service, error)

func GenerateRsaKey added in v0.9.10

func GenerateRsaKey() (map[string]string, error)

func GetChartsFolder

func GetChartsFolder() string

func GetClientSetForTest

func GetClientSetForTest(t *testing.T) *kubernetes.Clientset

func GetFormatTime added in v0.9.2

func GetFormatTime(timestamp int64) string

func IsConnectionRefusedError

func IsConnectionRefusedError(err error) bool

func IsNeedWaitError

func IsNeedWaitError(err error) bool

func IsUnexpectedEOFError

func IsUnexpectedEOFError(err error) bool

func Md5 added in v0.3.2

func Md5(str string) string

func ParseDataDirRaw

func ParseDataDirRaw(raw string) (hostPath, containerPath string, err error)

ParseDataDirRaw parse DataDir into hostPath, containerPath

func RandomInt32

func RandomInt32() string

RandomInt32 just generates a random string of int32

func Retry

func Retry(attempts int, sleep time.Duration, callback func() error) (err error)

func RetryDuring

func RetryDuring(duration time.Duration, sleep time.Duration, callback func() error) (err error)

func SelectAvailablePort

func SelectAvailablePort(client *kubernetes.Clientset) (int, error)

Select a available port in range (AUTO_SELECT_PORT_MIN ~ AUTO_SELECT_PORT_MAX), and exclude used ports in k8s if 20000 is selected this time, make sure next time it will select 20001

func SelectAvailablePortWithDefault

func SelectAvailablePortWithDefault(client *kubernetes.Clientset, port int) (int, error)

If default port is available, use it If not set defaultPort, select port automatically

func SetLogLevel

func SetLogLevel(level string)

SetLogLevel sets the logrus logging level

func ShortHumanDuration

func ShortHumanDuration(d time.Duration) string

ShortHumanDuration returns a succint representation of the provided duration with limited precision for consumption by humans.

func StringInSlice added in v0.3.0

func StringInSlice(x string, list []string) bool

func ValidateDatasets

func ValidateDatasets(dataset []string) (err error)

func ValidateDevices added in v0.10.0

func ValidateDevices(devices []string) error

func ValidateJobName

func ValidateJobName(value string) error

ValidateJobName validates the job name, its length should less than 63, and match dns1123LabelFmt

func ValidatePriorityClassName

func ValidatePriorityClassName(client *kubernetes.Clientset, name string) error

Check if PriorityClassName exists

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