randextensions

package
v2.0.0-...-a7294fb Latest Latest
Warning

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

Go to latest
Published: Dec 20, 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

func MakeRandomUUID() string

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

func MakeUUIDName

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

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

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