utils

package
v0.39.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyInMetadata

func AnyInMetadata(object *unstructured.Unstructured, metadata map[string]string) bool

AnyInMetadata searches for the specified key-value pairs in labels and annotations, returns true if at least one key-value pair matches.

func FmtObjMetadata

func FmtObjMetadata(obj object.ObjMetadata) string

FmtObjMetadata returns the object ID in the format <kind>/<namespace>/<name>.

func FmtUnstructured

func FmtUnstructured(obj *unstructured.Unstructured) string

FmtUnstructured returns the object ID in the format <kind>/<namespace>/<name>.

func FmtUnstructuredList

func FmtUnstructuredList(objects []*unstructured.Unstructured) string

FmtUnstructuredList returns a line per object in the format <kind>/<namespace>/<name>.

func IsCRD

func IsCRD(object *unstructured.Unstructured) bool

IsCRD returns true if the given object is a CustomResourceDefinition.

func IsClusterDefinition

func IsClusterDefinition(object *unstructured.Unstructured) bool

IsClusterDefinition checks if the given object is a Kubernetes namespace or a custom resource definition.

func IsKubernetesObject

func IsKubernetesObject(object *unstructured.Unstructured) bool

IsKubernetesObject checks if the given object has the minimum required fields to be a Kubernetes object.

func IsKustomization

func IsKustomization(object *unstructured.Unstructured) bool

IsKustomization checks if the given object is a Kustomize config.

func IsNamespace

func IsNamespace(object *unstructured.Unstructured) bool

IsNamespace returns true if the given object is a Namespace.

func IsSecret

func IsSecret(object *unstructured.Unstructured) bool

IsSecret returns true if the given object is a Kubernetes Secret.

func ObjectToYAML

func ObjectToYAML(object *unstructured.Unstructured) string

ObjectToYAML encodes the given Kubernetes API object to YAML.

func ObjectsToJSON

func ObjectsToJSON(objects []*unstructured.Unstructured) (string, error)

ObjectsToJSON encodes the given Kubernetes API objects to a YAML multi-doc.

func ObjectsToYAML

func ObjectsToYAML(objects []*unstructured.Unstructured) (string, error)

ObjectsToYAML encodes the given Kubernetes API objects to a YAML multi-doc.

func ReadObject

func ReadObject(r io.Reader) (*unstructured.Unstructured, error)

ReadObject decodes a YAML or JSON document from the given reader into an unstructured Kubernetes API object.

func ReadObjects

func ReadObjects(r io.Reader) ([]*unstructured.Unstructured, error)

ReadObjects decodes the YAML or JSON documents from the given reader into unstructured Kubernetes API objects. The documents which do not subscribe to the Kubernetes Object interface, are silently dropped from the result.

func SetCommonMetadata

func SetCommonMetadata(objects []*unstructured.Unstructured, labels map[string]string, annotations map[string]string)

SetCommonMetadata adds the specified labels and annotations to all objects. Existing keys will have their values overridden.

Types

This section is empty.

Jump to

Keyboard shortcuts

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