yaml

package
v2.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 10

Documentation

Overview

Package yaml handles the unmarshaling of YAML objects to strusts

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanAnnotationsForExport

func CleanAnnotationsForExport(annotations map[string]string) map[string]string

func CleanObjectForExport

func CleanObjectForExport(obj runtime.Object) (runtime.Object, error)

func Export

func Export(objects ...runtime.Object) ([]byte, error)

Export will attempt to clean up the objects a bit before rendering to yaml so that they can easily be imported into another cluster

func ToBytes

func ToBytes(objects []runtime.Object) ([]byte, error)

func ToObjects

func ToObjects(in io.Reader) ([]runtime.Object, error)

ToObjects takes a reader of yaml bytes and returns a list of unstructured.Unstructured runtime.Objects that are read. If one of the objects read is an unstructured.UnstructuredList then the list is flattened to individual objects.

func Unmarshal

func Unmarshal(data []byte, v interface{}) error

Unmarshal decodes YAML bytes into document (as defined by the YAML spec) then converting it to JSON via "k8s.io/apimachinery/pkg/util/yaml".YAMLToJSON and then decoding the json in the the v interface{}

func UnmarshalWithJSONDecoder

func UnmarshalWithJSONDecoder[T any](yamlReader io.Reader) ([]T, error)

UnmarshalWithJSONDecoder expects a reader of raw YAML. It converts the document or documents to JSON, then decodes the JSON bytes into a slice of values of type T. Type T must be a pointer, or the function will panic.

Types

This section is empty.

Jump to

Keyboard shortcuts

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