Documentation ¶
Overview ¶
Package object contains helpers to work with Kubernetes objects. It provides conversion functions that help when working with generic object types.
Index ¶
- func ClientObjects(scheme *runtime.Scheme, objs []runtime.Object) ([]client.Object, error)
- func GetObjectStatus(obj map[string]interface{}) (map[string]interface{}, error)
- func GetUnstructuredObject(scheme *runtime.Scheme, obj runtime.Object) (*unstructured.Unstructured, error)
- func IsInitialized(scheme *runtime.Scheme, obj runtime.Object) (bool, error)
- func NamespacedNames(instances client.ObjectList) ([]types.NamespacedName, error)
- func NamespacedNamesDiff(a, b []types.NamespacedName) []types.NamespacedName
- func NestedFieldNoCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error)
- func OwnerReferenceFromObject(obj client.Object) metav1.OwnerReference
- func StatusChanged(scheme *runtime.Scheme, oldo runtime.Object, newo runtime.Object) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientObjects ¶
ClientObjects converts a slice of runtime objects to a list of client.Object.
func GetObjectStatus ¶
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 ¶
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 ¶
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.
Types ¶
This section is empty.