helpers

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsSha256

func AsSha256(o interface{}) string

Generates (somewhat) unique hash of a struct (or anything else). Depends on the object's `String` method. Copied from blog post: https://blog.8bitzen.com/posts/22-08-2019-how-to-hash-a-struct-in-go

func CalculateVirtualServicePrefix

func CalculateVirtualServicePrefix(version, subset string) string

Calculates the prefix for naming virtual service route name prefix. Note that empty subset produces more inclusive prefix (e.g., everything belongs to this single dynamicenv).

func CommonValueExists

func CommonValueExists(l1, l2 []string) bool

Validate intersection between two slices is not empty/

func EnvVarContains

func EnvVarContains(envs []v1.EnvVar, env v1.EnvVar) bool

func MKSubsetName added in v0.2.0

func MKSubsetName(subset riskifiedv1alpha1.Subset) string

Just a convention to name subsets

func MatchNamespacedHost

func MatchNamespacedHost(hostname, namespace, matchedHost, inNamespace string) bool

MatchNamespacedHost compares the provided `hostname` and `namespace` to the provided `matchHost`. If `matchHost` is *not* fully qualified, it uses the `inNamespace` parameter to match against the searched namespace.

func MergeEnvVars

func MergeEnvVars(current []v1.EnvVar, overrides []v1.EnvVar) []v1.EnvVar

func MkLogger added in v0.2.0

func MkLogger(name string, keysAndValues ...interface{}) logr.Logger

Generates Logger with provided values

func MkResourceName added in v0.2.0

func MkResourceName(id types.NamespacedName) string

func MkSubsetUniqueName added in v0.2.0

func MkSubsetUniqueName(name, version string) string

func RemoveItemFromStringSlice

func RemoveItemFromStringSlice(s string, slc []string) []string

func Shorten

func Shorten(msg string, length int) string

Shortens the provided string to the desired length

func UniqueDynamicEnvName

func UniqueDynamicEnvName(id types.NamespacedName) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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