Documentation ¶
Overview ¶
Package utils offers functions of general utility in other parts of the system
Index ¶
- func DurationMillSeconds(d time.Duration) string
- func DurationSeconds(d time.Duration) string
- func GetBooleanEnvVar(envVar string, defaultValue bool) bool
- func GetInt32EnvVar(envVar string, defaultValue int32) int32
- func GetStringEnvVar(envVar string, defaultValue string) string
- func HasHostNetwork(pod corev1.Pod) bool
- func HasPort(pod corev1.Pod, port uint) bool
- func MapPort(service corev1.Service, port uint, pod corev1.Pod) (uint, error)
- func PodIP(pod corev1.Pod) (string, error)
- func Retry(timeout time.Duration, backoff time.Duration, f func() (bool, error)) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DurationMillSeconds ¶ added in v0.3.1
DurationMillSeconds returns the duration is milliseconds (e.g. "15ms")
func DurationSeconds ¶ added in v0.3.0
DurationSeconds returns the duration is seconds with a precession of 2 decimals, removing trailing zeros (e.g. "1.5s")
func GetBooleanEnvVar ¶ added in v0.3.4
GetBooleanEnvVar returns a boolean environment variable. If variable is not set or invalid value, returns the default value
func GetInt32EnvVar ¶ added in v0.3.8
GetInt32EnvVar returns an integer environment variable. If variable is not set or invalid value, returns the default value
func GetStringEnvVar ¶ added in v0.3.8
GetStringEnvVar returns a string environment variable. If variable is not set returns the default value
func HasHostNetwork ¶ added in v0.3.4
HasHostNetwork returns whether a pod has HostNetwork enabled, i.e. it shares the host's network namespace.
func MapPort ¶ added in v0.3.4
MapPort returns the port in the Pod that maps to the given service port
Types ¶
This section is empty.