utils

package
v0.0.0-...-12cfe02 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepEqual

func DeepEqual(val1, val2 interface{}) bool

DeepEqual should be used in place of reflect.DeepEqual when the type of an object is unknown and may be a proto message. see https://github.com/golang/protobuf/issues/1173 for details on why reflect.DeepEqual no longer works for proto messages

func FindOwnedObjects

func FindOwnedObjects(ctx context.Context, cl client.Client, uid types.UID, namespace string, objectTypes []client.Object) (map[types.UID]client.Object, error)

FindOwnedObjects looks for objects in the given namespace that have an owner reference. Note: this method assumes that an index has been setup for the owner reference using `SetupOwnerIndexes`.

func GetList

func GetList[T client.Object](ctx context.Context, cl client.Client, l T, options ...client.ListOption) (map[types.UID]client.Object, error)

GetList queries the Kubernetes API to list the requested resource, setting the list l of type T.

func ObjectMetasEqual

func ObjectMetasEqual(obj1, obj2 metav1.Object) bool

returns true if "relevant" parts of obj1 and obj2 have equal: -labels -annotations -namespace+name or if the objects are not metav1.Objects

func ObjectsEqual

func ObjectsEqual(obj1, obj2 runtime.Object) bool

returns true if "relevant" parts of obj1 and obj2 have equal: - labels, - annotations, - namespace+name, - non-metadata, non-status fields Note that Status fields are not compared. To compare status fields, use ObjectStatusesEqual

func SetupOwnerIndexes

func SetupOwnerIndexes(mgr ctrl.Manager, ownedTypes []client.Object) error

SetupOwnerIndexes sets up caching and indexing of owned resources.

Types

This section is empty.

Jump to

Keyboard shortcuts

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