utils

package
v1.6.1-0...-f207c0f Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromUnstructured

func FromUnstructured(in unstructured.Unstructured, out client.Object) error

FromUnstructured converts an unstructured.Unstructured object to a typed client.Object. It returns an error if the conversion fails.

func GatewaysSliceToAnnotation

func GatewaysSliceToAnnotation(gateways []gwtypes.Gateway) string

GatewaysSliceToAnnotation converts a slice of Gateway objects to a comma-separated string in the format "namespace/name,namespace/name,..."

func Hash32

func Hash32(obj any) string

Hash32 returns a hash string representation of the given object using FNV-1a hashing.

func Hash64

func Hash64(obj any) string

Hash64 returns a hash string representation of the given object using FNV-1a hashing.

func KeepProgrammed

func KeepProgrammed(objs []unstructured.Unstructured) []unstructured.Unstructured

KeepProgrammed filters the given slice of unstructured.Unstructured objects, returning only those that are not in the "Programmed" condition. If all objects are programmed, it returns the original slice.

func KeepYoungest

func KeepYoungest(objs []unstructured.Unstructured) []unstructured.Unstructured

KeepYoungest returns a new slice with all elements except the youngest (most recently created) object removed from the input slice. If the input slice is empty, it returns nil.

func SetMetadata

func SetMetadata(owner, obj client.Object, hashSpec string, routeAnnotation string, gatewaysAnnotation string) error

SetMetadata sets the metadata for the given Object

func ToUnstructured

func ToUnstructured(obj client.Object, scheme *runtime.Scheme) (unstructured.Unstructured, error)

ToUnstructured converts a client.Object to an unstructured.Unstructured object. It infers TypeMeta using the provided scheme if not set. Returns the unstructured object and any error encountered during conversion.

Types

type ReduceFunc

ReduceFunc defines a function type that takes a slice of unstructured.Unstructured objects and returns a (possibly modified or filtered) slice of unstructured.Unstructured objects.

Jump to

Keyboard shortcuts

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