dependson

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Annotation = "config.kubernetes.io/depends-on"
)

Variables

This section is empty.

Functions

func FormatDependencySet

func FormatDependencySet(depSet DependencySet) (string, error)

FormatDependencySet formats the passed dependency set as a string.

Object references are separated by ','.

Returns the formatted DependencySet or an error if unable to format.

func FormatObjMetadata

func FormatObjMetadata(obj object.ObjMetadata) (string, error)

FormatObjMetadata formats the passed object metadata as a string.

Object references can have either three fields (cluster-scoped object) or five fields (namespace-scoped object).

Fields are separated by '/'.

Examples:

Cluster-Scoped: <group>/<kind>/<name> (3 fields)
Namespaced: <group>/namespaces/<namespace>/<kind>/<name> (5 fields)

Group and namespace may be empty, but name and kind may not.

Returns the formatted ObjMetadata string or an error if unable to format.

func HasAnnotation

func HasAnnotation(u *unstructured.Unstructured) bool

HasAnnotation returns true if the config.kubernetes.io/depends-on annotation is present, false if not.

func ParseObjMetadata

func ParseObjMetadata(objStr string) (object.ObjMetadata, error)

ParseObjMetadata parses the passed string as a object metadata.

Object references can have either three fields (cluster-scoped object) or five fields (namespace-scoped object).

Fields are separated by '/'.

Examples:

Cluster-Scoped: <group>/<kind>/<name> (3 fields)
Namespaced: <group>/namespaces/<namespace>/<kind>/<name> (5 fields)

Group and namespace may be empty, but name and kind may not.

Returns the parsed ObjMetadata or an error if unable to parse.

func WriteAnnotation

func WriteAnnotation(obj *unstructured.Unstructured, depSet DependencySet) error

WriteAnnotation updates the supplied unstructured object to add the depends-on annotation. The value is a string of objmetas delimited by commas. Each objmeta is formatted as "${group}/${kind}/${name}" if cluster-scoped or "${group}/namespaces/${namespace}/${kind}/${name}" if namespace-scoped.

Types

type DependencySet

type DependencySet object.ObjMetadataSet

DependencySet is a set of object references. When testing equality, order is not importent.

func ParseDependencySet

func ParseDependencySet(depsStr string) (DependencySet, error)

ParseDependencySet parses the passed string as a set of object references.

Object references are separated by ','.

Returns the parsed DependencySet or an error if unable to parse.

func ReadAnnotation

func ReadAnnotation(u *unstructured.Unstructured) (DependencySet, error)

ReadAnnotation reads the depends-on annotation and parses the the set of object references.

func (DependencySet) Equal

func (a DependencySet) Equal(b DependencySet) bool

Equal returns true if the ObjMetadata sets are equivalent, ignoring order. Fulfills Equal interface from github.com/google/go-cmp

Jump to

Keyboard shortcuts

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