util

package
v0.3.1-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: Apache-2.0, Apache-2.0 Imports: 15 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 DNS1123LabelMaxLength int = 63
View Source
const DNS1123SubdomainMaxLength int = 253
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 GetChartsFolder

func GetChartsFolder() string

func GetClientSetForTest

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

func IsConnectionRefusedError

func IsConnectionRefusedError(err error) bool

func IsNeedWaitError

func IsNeedWaitError(err error) bool

func IsUnexpectedEOFError

func IsUnexpectedEOFError(err error) bool

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 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