common

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddChild added in v0.13.0

func AddChild(parent *DNSTreeNode, child *DNSTreeNode)

func AddLabelToBranch added in v0.13.0

func AddLabelToBranch(node *DNSTreeNode, branch, label, value string)

func AddLabelToTree added in v0.13.0

func AddLabelToTree(node *DNSTreeNode, label, value string)

func GetLeafsTargets added in v0.7.0

func GetLeafsTargets(node *DNSTreeNode, targets *[]string) *[]string

GetLeafsTargets returns IP or CNAME of the leafs of a tree. alternatively, it can populate the passed in array with pointers to targets

func HasLabelForBranch added in v0.13.0

func HasLabelForBranch(node *DNSTreeNode, branch, label, value string) bool

func HashRootHost added in v0.15.0

func HashRootHost(rootHost string) string

HashRootHost generates a hash value of the given root host with a fixed length of 8

func MergeLabels added in v0.15.0

func MergeLabels(object metav1.Object, labels map[string]string) bool

MergeLabels combines the map of labels to the existing labels on an object

func ParseGVKString added in v0.15.0

func ParseGVKString(gvkStr string) (schema.GroupVersionKind, error)

func ParseGVRString added in v0.15.0

func ParseGVRString(gvkStr string) (schema.GroupVersionResource, error)

func PropagateStoppableLabel added in v0.13.0

func PropagateStoppableLabel(node *DNSTreeNode, propLabel, value, stopLabel string)

func RandomizeDuration

func RandomizeDuration(variance, duration float64) time.Duration

RandomizeDuration randomizes duration for a given variance. variance is expected to be of a format 0.1 for 10%, 0.5 for 50% and so on

func RandomizeValidationDuration added in v0.8.0

func RandomizeValidationDuration(variance float64, duration time.Duration) time.Duration

RandomizeValidationDuration randomizes duration for a given variance with a min value of 1 sec variance is expected to be of a format 0.1 for 10%, 0.5 for 50% and so on

func RemoveLabelFromParents added in v0.13.0

func RemoveLabelFromParents(node *DNSTreeNode, label string)

func RemoveLabelFromTree added in v0.13.0

func RemoveLabelFromTree(node *DNSTreeNode, label string)

func ToEndpoints added in v0.7.0

func ToEndpoints(node *DNSTreeNode, endpoints *[]*endpoint.Endpoint) *[]*endpoint.Endpoint

ToEndpoints transforms a tree into an array of endpoints. The array could be returned or passed in to be populated

Types

type DNSTreeNode added in v0.7.0

type DNSTreeNode struct {
	Name     string
	Children []*DNSTreeNode
	DataSets []DNSTreeNodeData
	Parent   *DNSTreeNode
}

DNSTreeNode stores a relation between endpoints that were parsed into a tree

func MakeTreeFromDNSRecord added in v0.7.0

func MakeTreeFromDNSRecord(record *v1alpha1.DNSRecord) *DNSTreeNode

func (*DNSTreeNode) RemoveNode added in v0.7.0

func (n *DNSTreeNode) RemoveNode(deleteNode *DNSTreeNode)

RemoveNode removes a node from a tree. If the node was the only child of the parent node, the parent will be removed as well unless the parent is a root node

type DNSTreeNodeData added in v0.7.0

type DNSTreeNodeData struct {
	RecordType       string
	SetIdentifier    string
	RecordTTL        endpoint.TTL
	Labels           endpoint.Labels
	ProviderSpecific endpoint.ProviderSpecific
	Targets          []string
}

DNSTreeNodeData holds a data for the enpoint(s) that correspond to this node

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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