object

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: MIT Imports: 10 Imported by: 3

Documentation

Overview

Package object contains helpers to work with Kubernetes objects. It provides conversion functions that help when working with generic object types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientObjects

func ClientObjects(scheme *runtime.Scheme, objs []runtime.Object) ([]client.Object, error)

ClientObjects converts a slice of runtime objects to a list of client.Object.

func GetObjectStatus

func GetObjectStatus(obj map[string]interface{}) (map[string]interface{}, error)

GetObjectStatus returns the status of a given object, if any.

func GetUnstructuredObject

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

GetUnstructuredObject converts the given Object into Unstructured type.

func IsInitialized

func IsInitialized(scheme *runtime.Scheme, obj runtime.Object) (bool, error)

IsInitialized checks if an object is initialized by checking if there's any status condition.

func NamespacedNames

func NamespacedNames(instances client.ObjectList) ([]types.NamespacedName, error)

NamespacedNames converts an ObjectList to a slice of NamespacedNames.

func NamespacedNamesDiff

func NamespacedNamesDiff(a, b []types.NamespacedName) []types.NamespacedName

NamespacedNamesDiff takes two slices of NamespacedNames and returns a slice of elements from the list a that are not present in list b.

func NestedFieldNoCopy

func NestedFieldNoCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error)

NestedFieldNoCopy returns the nested field from a given Object. The second returned value is true if the field is found, else false.

Taken from kubebuilder-declarative-pattern's manifest package: https://github.com/kubernetes-sigs/kubebuilder-declarative-pattern/blob/b731a62175207a3d8343d318e72ddc13896bcb3f/pkg/patterns/declarative/pkg/manifest/objects.go#L96

func OwnerReferenceFromObject

func OwnerReferenceFromObject(obj client.Object) metav1.OwnerReference

OwnerReferenceFromObject creates an owner reference with the given object.

func StatusChanged

func StatusChanged(scheme *runtime.Scheme, oldo runtime.Object, newo runtime.Object) (bool, error)

StatusChanged gets the status of the given objects and compares them. It returns true if there's a change in the object status.

Types

This section is empty.

Jump to

Keyboard shortcuts

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