Documentation ¶
Index ¶
- Variables
- func ComputeTokens(dcCounts []int, partitioner Partitioner) [][]string
- func ContainerHasEnvVar(container *corev1.Container, name, value string) bool
- func ContainsVolume(volumes []corev1.Volume, name string) (int, bool)
- func CopyFile(src, dest string) error
- func CopyFileToDir(src, destDir string) (string, error)
- func DeepHashObject(hasher hash.Hash, objectToWrite interface{})
- func DeepHashString(obj interface{}) string
- func FindAndGetContainer(deployment *appsv1.Deployment, name string) *corev1.Container
- func FindAndGetVolume(deployment *appsv1.Deployment, name string) *corev1.Volume
- func FindContainer(deployment *appsv1.Deployment, name string) (int, bool)
- func FindEnvVar(envVars []corev1.EnvVar, name string) *corev1.EnvVar
- func FindEnvVarInContainer(container *corev1.Container, name string) *corev1.EnvVar
- func FindVolume(deployment *appsv1.Deployment, name string) (int, bool)
- func FindVolumeMount(container *corev1.Container, name string) *corev1.VolumeMount
- func FirstNonEmptyString(strs ...string) string
- func GetEnvVarIndex(name string, envVars []corev1.EnvVar) int
- func GetKey(obj metav1.Object) client.ObjectKey
- func GetMapNested(m map[string]interface{}, key string, keys ...string) (interface{}, bool)
- func HashNameNamespace(name, namespace string) string
- func ListFiles(root, pattern string) ([]string, error)
- func MergeMap(sources ...map[string]string) map[string]string
- func MergeMapNested(allowOverwrite bool, sources ...map[string]interface{}) (map[string]interface{}, error)
- func PutMapNested(allowOverwrite bool, m map[string]interface{}, val interface{}, key string, ...) error
- func ReadLines(file string) ([]string, error)
- func RemoveValue(slice []string, value string) []string
- func SliceContains(slice []string, s string) bool
- func UnmarshalToMap(data []byte) (map[string]interface{}, error)
- type Partitioner
Constants ¶
This section is empty.
Variables ¶
var Murmur3Partitioner = Partitioner{ RingOffset: new(big.Int).Lsh(newBigInt(-1), 63), RingRange: new(big.Int).Lsh(one, 64), }
var RandomPartitioner = Partitioner{ RingOffset: new(big.Int), RingRange: new(big.Int).Lsh(one, 127), }
Functions ¶
func ComputeTokens ¶ added in v1.4.0
func ComputeTokens(dcCounts []int, partitioner Partitioner) [][]string
ComputeTokens takes a list of numbers indicating the number of nodes in each datacenter, and returns a recommended list of tokens for the given partitioner (one token per node, grouped by datacenter).
func ContainerHasEnvVar ¶ added in v1.6.0
func ContainsVolume ¶ added in v1.6.0
func CopyFile ¶ added in v1.1.0
CopyFile copies file src to file dest. File src must exist. File dest doesn't need to exist nor its parent directories, they will be created if required. Existing dest file will be overwritten.
func CopyFileToDir ¶ added in v1.1.0
CopyFileToDir copies file src to directory destDir. File src must exist. Directory destDir doesn't need exist nor its parent directories, they will be created if required. The destination file will have the same name as src. If that file already exists, it will be overwritten.
func DeepHashObject ¶ added in v1.3.0
DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.
func DeepHashString ¶
func DeepHashString(obj interface{}) string
func FindAndGetContainer ¶ added in v1.5.0
func FindAndGetContainer(deployment *appsv1.Deployment, name string) *corev1.Container
func FindAndGetVolume ¶ added in v1.5.0
func FindAndGetVolume(deployment *appsv1.Deployment, name string) *corev1.Volume
func FindContainer ¶ added in v1.5.0
func FindContainer(deployment *appsv1.Deployment, name string) (int, bool)
func FindEnvVar ¶ added in v1.2.0
func FindEnvVarInContainer ¶ added in v1.2.0
func FindVolume ¶ added in v1.5.0
func FindVolume(deployment *appsv1.Deployment, name string) (int, bool)
func FindVolumeMount ¶ added in v1.5.0
func FindVolumeMount(container *corev1.Container, name string) *corev1.VolumeMount
func FirstNonEmptyString ¶ added in v1.4.0
FirstNonEmptyString returns the first non-empty string in the provided list of strings. If all strings are empty, an empty string is returned.
func GetMapNested ¶ added in v1.1.0
GetMapNested gets the value at the given keys in the given map. It returns nil and false if the map does not contain all the keys.
func HashNameNamespace ¶ added in v1.15.0
func ListFiles ¶ added in v1.1.0
ListFiles lists all files whose names match pattern in root directory and its subdirectories.
func MergeMap ¶
MergeMap will take two or more maps, merging the entries of the sources map into a destination map. If both maps share the same key then destination's value for that key will be overwritten with what's in source.
func MergeMapNested ¶ added in v1.1.0
func MergeMapNested(allowOverwrite bool, sources ...map[string]interface{}) (map[string]interface{}, error)
MergeMapNested will take two or more maps, merging the entries of the sources map into a destination map. If both maps share the same key then destination's value for that key will be merged with what's in source. The source maps are not modified. If allowOverwrite is false, an error is returned if the key already exists and its value is not nil.
func PutMapNested ¶ added in v1.1.0
func PutMapNested(allowOverwrite bool, m map[string]interface{}, val interface{}, key string, keys ...string) error
PutMapNested puts the given value in the given map at the given keys. When a key is not present, the entry is created on the fly; nested entries are always of type map[string]interface{} to allow for nested entries to be further inserted. If allowOverwrite is false, an error is returned if the key already exists and its value is not nil.