util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Annotations added in v0.7.3

func Annotations(labels map[string]string, kind string) map[string]string

func ByteArrayToAlphaNum added in v0.2.0

func ByteArrayToAlphaNum(bytes []byte) string

func ConfigGetInt32

func ConfigGetInt32(config map[string]string, key string, defaultValue int32) int32

ConfigGetInt32 extracts the int32 value from the entry with the given key

Returns `defaultValue` if either the entry does not exist, or is not a numeric value.

func Converter added in v0.3.1

func Converter(labels map[string]string) *string

func GetBoolean added in v0.3.0

func GetBoolean(labels map[string]string, key string) bool

func GetEnv

func GetEnv() map[string]string

func GetEnvValueCaseInsensitive added in v0.5.0

func GetEnvValueCaseInsensitive(caseInsensitiveKey string) string

func GetOptional added in v0.3.0

func GetOptional(labels map[string]string, key string) *string

func IsShared added in v0.3.0

func IsShared(labels map[string]string) bool

IsShared determines whether a volume is shared between replicas

func IsSingleton added in v0.3.0

func IsSingleton(labels map[string]string) bool

IsSingleton determine whether a resource (according to its labels) should be treated as a singleton.

func IsTruthy

func IsTruthy(s string) bool

IsTruthy determines whether the given string is a representation of a "true" state.

Concretly, it currently tests for "true", "yes" or "1", ignoring character cases.

func PartOf added in v0.7.0

func PartOf(labels map[string]string) *string

func Sanitize

func Sanitize(str string) string

Sanitize ensures a string only contains alphanumeric characters, and starts with a letter

func SanitizeWithMinLength

func SanitizeWithMinLength(str string, minLength int) string

SanitizeWithMinLength applies `Sanitize`, and then ensures the result is at least `minLength` characters long.

If the resulting string is too short, a stable generated value of `minLength` characters will be returned.

func ServiceAccountName added in v0.4.0

func ServiceAccountName(labels map[string]string) string

func ServiceExternalTrafficPolicy added in v0.10.0

func ServiceExternalTrafficPolicy(labels map[string]string, port int32) core.ServiceExternalTrafficPolicy

func ServiceHealthCheckNodePort added in v0.10.0

func ServiceHealthCheckNodePort(labels map[string]string, port int32) int32

func ServiceType added in v0.10.0

func ServiceType(labels map[string]string, port int32) core.ServiceType

func StorageClass added in v0.3.0

func StorageClass(labels map[string]string) *string

StorageClass determines a storage class from a set of labels

func StorageSize added in v0.3.0

func StorageSize(labels map[string]string, fallback string) resource.Quantity

StorageSize determines the requested storage size for a volume, or a fallback value.

func StorageSizeRaw added in v0.3.0

func StorageSizeRaw(labels map[string]string) *string

func SubConfig

func SubConfig(config map[string]string, prefix string, defaultKey string) map[string]string

SubConfig extracts the keys that start with a given prefix from a given config map

If there is a key that is EQUAL to the prefix, the entry identified by `defaultKey` will be updated.

If there is a key that is equal to the prefix, AND an entry corresponding to `defaultKey`, the behavior is undefined!

Types

This section is empty.

Jump to

Keyboard shortcuts

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