Documentation ¶
Overview ¶
Package k8sutil contains utilities for manipulating Kubernetes objects
Index ¶
- func BuildObjectsFromYMLs(filePaths []string) ([]*unstructured.Unstructured, error)
- func BuildSortableObjectsFromYMLs(filePaths []string) ([]*unstructured.Unstructured, error)
- func DescribeObj(obj client.Object) string
- func EnsureKubernetesObject(object *unstructured.Unstructured) error
- func EnsureKustomizeObject(object *unstructured.Unstructured) error
- func Equals(i, j schema.GroupKind) bool
- func IsExtensionYML(f string) bool
- func IsKubernetesObject(object *unstructured.Unstructured) bool
- func IsKustomizeObject(object *unstructured.Unstructured) bool
- func IsLessThan(i, j schema.GroupKind) bool
- func IsNilUnstructured(given *unstructured.Unstructured) bool
- func MaybeAppend(list []client.Object, add client.Object) []client.Object
- func MaybeAppendList(list []client.Object, add []client.Object) []client.Object
- func MaybeAppendUnstructured(list []*unstructured.Unstructured, add *unstructured.Unstructured) []*unstructured.Unstructured
- func MaybeAppendUnstructuredList(list []*unstructured.Unstructured, add []*unstructured.Unstructured) []*unstructured.Unstructured
- func ObjKey(obj client.Object) string
- func ReadKubernetesObjects(r io.Reader) ([]*unstructured.Unstructured, error)
- func ScanForYMLsFromDir(dir string) ([]string, error)
- func ScanForYMLsFromPaths(paths []string) ([]string, error)
- func ToTyped(src *unstructured.Unstructured, dest interface{}) error
- func ToUnstructured(src metav1.Object, dest *unstructured.Unstructured) error
- type SortableMetas
- type SortableUnstructureds
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildObjectsFromYMLs ¶
func BuildObjectsFromYMLs(filePaths []string) ([]*unstructured.Unstructured, error)
func BuildSortableObjectsFromYMLs ¶
func BuildSortableObjectsFromYMLs(filePaths []string) ([]*unstructured.Unstructured, error)
func DescribeObj ¶
DescribeObj returns a string format of the provided object that may be used for logging purposes
func EnsureKubernetesObject ¶
func EnsureKubernetesObject(object *unstructured.Unstructured) error
EnsureKubernetesObject returns error if the provided unstructured instance is not a Kubernetes schema
func EnsureKustomizeObject ¶
func EnsureKustomizeObject(object *unstructured.Unstructured) error
EnsureKustomizeObject returns error if the provided unstructured instance is not a Kustomize schema
func IsExtensionYML ¶
IsExtensionYML returns true if provided file has yaml extension
func IsKubernetesObject ¶
func IsKubernetesObject(object *unstructured.Unstructured) bool
IsKubernetesObject returns true if the provided unstructured instance resembles a Kubernetes schema
func IsKustomizeObject ¶
func IsKustomizeObject(object *unstructured.Unstructured) bool
IsKustomizeObject returns true if the provided unstructured instance resembles a Kustomize schema
func IsLessThan ¶
func IsNilUnstructured ¶
func IsNilUnstructured(given *unstructured.Unstructured) bool
func MaybeAppendList ¶
func MaybeAppendUnstructured ¶
func MaybeAppendUnstructured(list []*unstructured.Unstructured, add *unstructured.Unstructured) []*unstructured.Unstructured
func MaybeAppendUnstructuredList ¶
func MaybeAppendUnstructuredList(list []*unstructured.Unstructured, add []*unstructured.Unstructured) []*unstructured.Unstructured
func ObjKey ¶
ObjKey returns a string that can be used as a key to store objects of type client.Object
func ReadKubernetesObjects ¶
func ReadKubernetesObjects(r io.Reader) ([]*unstructured.Unstructured, error)
ReadKubernetesObjects decodes the YAML or JSON documents from the provided reader into unstructured Kubernetes API objects
func ScanForYMLsFromDir ¶
ScanForYMLsFromDir scans for files present in the provided directory & its sub-directories if any
func ScanForYMLsFromPaths ¶
func ToTyped ¶
func ToTyped(src *unstructured.Unstructured, dest interface{}) error
ToTyped transforms the provided unstructured instance to dest instance
func ToUnstructured ¶
func ToUnstructured(src metav1.Object, dest *unstructured.Unstructured) error
ToUnstructured transforms the provided object instance to unstructured
Types ¶
type SortableMetas ¶
type SortableMetas []object.ObjMetadata
func (SortableMetas) Len ¶
func (a SortableMetas) Len() int
func (SortableMetas) Less ¶
func (a SortableMetas) Less(i, j int) bool
func (SortableMetas) Swap ¶
func (a SortableMetas) Swap(i, j int)
type SortableUnstructureds ¶
type SortableUnstructureds []*unstructured.Unstructured
func (SortableUnstructureds) Len ¶
func (a SortableUnstructureds) Len() int
func (SortableUnstructureds) Less ¶
func (a SortableUnstructureds) Less(i, j int) bool
func (SortableUnstructureds) Swap ¶
func (a SortableUnstructureds) Swap(i, j int)