randextensions

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Namespace = uuid.Must(uuid.Parse("9a329043-7ad7-4b1c-812f-9c7a93d6392a"))

Namespace is the ASOv2 UUIDv5 namespace UUID

Functions

func Jitter

func Jitter(r *rand.Rand, t time.Duration, jitter float64) time.Duration

Jitter returns the provided duration, scaled by a jitter factor. jitter must be between 0 and 1. After jitter is applied the result will be in the range: [(1-jitter)t, (1+jitter)t], UNLESS (1+jitter)t is larger than MaxInt64, in which case the range will be [(1-jitter)t, math.MaxInt64]

func MakeRandomUUID added in v2.9.0

func MakeRandomUUID() string

MakeRandomUUID creates a random UUID string. The uuid generated will always be distinct.

func MakeUUIDName added in v2.2.0

func MakeUUIDName(name string, uniqueString string) string

MakeUUIDName creates a stable UUID (v5) if the provided name is not already a UUID based on the specified uniqueString.

func MakeUniqueOwnerScopedString added in v2.8.0

func MakeUniqueOwnerScopedString(owner *genruntime.ResourceReference, gk schema.GroupKind, namespace string, name string) string

MakeUniqueOwnerScopedString generates a string that uniquely identifies a cluster resource. It includes the following distinguishing parts: * Owner (either group, kind, namespace, name or raw ARM ID) * Group * Kind * Namespace * Name

func MakeUniqueOwnerScopedStringLegacy added in v2.8.0

func MakeUniqueOwnerScopedStringLegacy(owner *genruntime.ResourceReference, gk schema.GroupKind, namespace string, name string) string

MakeUniqueOwnerScopedStringLegacy preserves the old buggy behavior with ARM ID owners, for now... Deprecated: use MakeUniqueOwnerScopedString instead

Types

This section is empty.

Jump to

Keyboard shortcuts

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