randextensions

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: MIT Imports: 6 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 MakeUUIDName added in v2.2.0

func MakeUUIDName(ownerGK schema.GroupKind, ownerName string, gk schema.GroupKind, namespace string, name string) string

MakeUUIDName creates a stable UUID (v5) based on the group, kind, namespace, and name of a resource and its owner. If the name of the resource is already a compliant UUID, we just use that. If the name is not a UUID one is generated and returned.

func MakeUniqueResourceString added in v2.2.0

func MakeUniqueResourceString(group string, kind string, namespace string, name string) string

MakeUniqueResourceString generates a string that uniquely identifies a cluster resource.

func MakeUniqueResourceString2 added in v2.2.0

func MakeUniqueResourceString2(ownerGK schema.GroupKind, ownerName string, gk schema.GroupKind, namespace string, name string) string

TODO: Fix name MakeUniqueResourceString generates a string that uniquely identifies a cluster resource.

Types

This section is empty.

Jump to

Keyboard shortcuts

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