kioutil

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 7 Imported by: 82

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfirmInternalAnnotationUnchanged added in v0.13.0

func ConfirmInternalAnnotationUnchanged(r1 *yaml.RNode, r2 *yaml.RNode, exclusions ...AnnotationKey) error

ConfirmInternalAnnotationUnchanged compares the annotations of the RNodes that begin with the prefix `internal.config.kubernetes.io`, throwing an error if they differ. It takes a parameter exclusions, which is a list of annotation keys to ignore.

func CopyInternalAnnotations added in v0.13.0

func CopyInternalAnnotations(src *yaml.RNode, dst *yaml.RNode, exclusions ...AnnotationKey) error

CopyInternalAnnotations copies the annotations that begin with the prefix `internal.config.kubernetes.io` from the source RNode to the destination RNode. It takes a parameter exclusions, which is a list of annotation keys to ignore.

func CopyLegacyAnnotations added in v0.12.0

func CopyLegacyAnnotations(rn *yaml.RNode) error

func CreatePathAnnotationValue added in v0.0.6

func CreatePathAnnotationValue(dir string, m yaml.ResourceMeta) string

CreatePathAnnotationValue creates a default path annotation value for a Resource. The path prefix will be dir.

func DefaultPathAndIndexAnnotation added in v0.0.6

func DefaultPathAndIndexAnnotation(dir string, nodes []*yaml.RNode) error

DefaultPathAndIndexAnnotation sets a default path or index value on any nodes missing the annotation

func DefaultPathAnnotation added in v0.0.6

func DefaultPathAnnotation(dir string, nodes []*yaml.RNode) error

DefaultPathAnnotation sets a default path annotation on any Reources missing it.

func ErrorIfMissingAnnotation

func ErrorIfMissingAnnotation(nodes []*yaml.RNode, keys ...AnnotationKey) error

ErrorIfMissingAnnotation validates the provided annotations are present on the given resources

func GetFileAnnotations

func GetFileAnnotations(rn *yaml.RNode) (string, string, error)

func GetIdAnnotation added in v0.13.1

func GetIdAnnotation(rn *yaml.RNode) string

func GetInternalAnnotations added in v0.13.0

func GetInternalAnnotations(rn *yaml.RNode) map[string]string

GetInternalAnnotations returns a map of all the annotations of the provided RNode that satisfies one of the following: 1) begin with the prefix `internal.config.kubernetes.io` 2) is one of `config.kubernetes.io/path`, `config.kubernetes.io/index` and `config.k8s.io/id`.

func Map

func Map(nodes []*yaml.RNode, fn func(*yaml.RNode) (*yaml.RNode, error)) ([]*yaml.RNode, error)

Map invokes fn for each element in nodes.

func MapMeta

func MapMeta(nodes []*yaml.RNode, fn func(*yaml.RNode, yaml.ResourceMeta) (*yaml.RNode, error)) (
	[]*yaml.RNode, error)

func SortNodes

func SortNodes(nodes []*yaml.RNode) error

SortNodes sorts nodes in place: - by PathAnnotation annotation - by IndexAnnotation annotation

Types

type AnnotationKey

type AnnotationKey = string
const (

	// IndexAnnotation records the index of a specific resource in a file or input stream.
	IndexAnnotation AnnotationKey = internalPrefix + "index"

	// PathAnnotation records the path to the file the Resource was read from
	PathAnnotation AnnotationKey = internalPrefix + "path"

	// SeqIndentAnnotation records the sequence nodes indentation of the input resource
	SeqIndentAnnotation AnnotationKey = internalPrefix + "seqindent"

	// IdAnnotation records the id of the resource to map inputs to outputs
	IdAnnotation AnnotationKey = internalPrefix + "id"

	// Deprecated: Use IndexAnnotation instead.
	LegacyIndexAnnotation AnnotationKey = "config.kubernetes.io/index"

	// Deprecated: use PathAnnotation instead.
	LegacyPathAnnotation AnnotationKey = "config.kubernetes.io/path"

	// Deprecated: use IdAnnotation instead.
	LegacyIdAnnotation = "config.k8s.io/id"

	// InternalAnnotationsMigrationResourceIDAnnotation is used to uniquely identify
	// resources during round trip to and from a function execution. We will use it
	// to track the internal annotations and reconcile them if needed.
	InternalAnnotationsMigrationResourceIDAnnotation = internalPrefix + "annotations-migration-resource-id"
)

Jump to

Keyboard shortcuts

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