mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
28 lines
652 B
Go
28 lines
652 B
Go
package utils
|
|
|
|
import (
|
|
corev1 "k8s.io/api/core/v1"
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
// IsCreated returns true if pod has been created and is maintained by the API server
|
|
func IsCreated(pod *corev1.Pod) bool {
|
|
return pod.Status.Phase != ""
|
|
}
|
|
|
|
// Get substring before a string.
|
|
func Before(value string, a string) string {
|
|
pos := strings.Index(value, a)
|
|
if pos == -1 {
|
|
return ""
|
|
}
|
|
return value[0:pos]
|
|
}
|
|
|
|
// FormatInt returns the string representation of i in the given base,
|
|
// for 2 <= base <= 36. The result uses the lower-case letters 'a' to 'z'
|
|
// for digit values >= 10.
|
|
func FormatInt32(n int32) string {
|
|
return strconv.FormatInt(int64(n), 10)
|
|
}
|