Documentation
¶
Overview ¶
Package metautils provides utilities to work with objects on the meta layer.
Index ¶
- func ConvertAndSetList(scheme *runtime.Scheme, list runtime.Object, objs []runtime.Object) error
- func ExtractList(obj client.ObjectList) ([]client.Object, error)
- func ExtractObjectSlice(slice interface{}) ([]client.Object, error)
- func ExtractObjectSlicePointer(slicePtr interface{}) ([]client.Object, error)
- func FilterControlledBy(scheme *runtime.Scheme, owner client.Object, objects []client.Object) ([]client.Object, error)
- func GVKForList(scheme *runtime.Scheme, list runtime.Object) (schema.GroupVersionKind, error)
- func IsControlledBy(scheme *runtime.Scheme, owner, controlled client.Object) (bool, error)
- func ListElementType(list runtime.Object) (reflect.Type, error)
- func SetList(list client.ObjectList, objects []client.Object) error
- func SetObjectSlice(slicePtr interface{}, objects []client.Object) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAndSetList ¶
ConvertAndSetList converts the given runtime.Objects into the item type of the list and sets the list items to be the converted items.
func ExtractList ¶ added in v0.3.5
func ExtractList(obj client.ObjectList) ([]client.Object, error)
ExtractList extracts the items of a list into a slice of client.Object.
func ExtractObjectSlice ¶ added in v0.3.5
ExtractObjectSlice extracts client.Object from a given slice.
func ExtractObjectSlicePointer ¶ added in v0.3.5
func FilterControlledBy ¶ added in v0.3.5
func FilterControlledBy(scheme *runtime.Scheme, owner client.Object, objects []client.Object) ([]client.Object, error)
FilterControlledBy filters multiple objects by using IsControlledBy on each item.
func GVKForList ¶
GVKForList determines the schema.GroupVersionKind for the given list. Effectively, this strips a 'List' suffix from the kind, if it exists.
func IsControlledBy ¶ added in v0.3.3
IsControlledBy checks if controlled is controlled by owner. An object is considered to be controlled if there is a controller (via metav1.GetControllerOf) whose GVK, name and UID match with the controller object.
func ListElementType ¶
ListElementType returns the element type of the list. For instance, for an appsv1.DeploymentList, the element type is appsv1.Deployment.
func SetList ¶ added in v0.3.5
func SetList(list client.ObjectList, objects []client.Object) error
SetList sets the items in a client.ObjectList to the given objects.
func SetObjectSlice ¶ added in v0.3.5
SetObjectSlice sets a slice pointer's values to the given objects.
Types ¶
This section is empty.