utils

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BuildAnnotationPreviousKinds      = konfig.ConfigAnnoDomain + "/previousKinds"
	BuildAnnotationPreviousNames      = konfig.ConfigAnnoDomain + "/previousNames"
	BuildAnnotationPrefixes           = konfig.ConfigAnnoDomain + "/prefixes"
	BuildAnnotationSuffixes           = konfig.ConfigAnnoDomain + "/suffixes"
	BuildAnnotationPreviousNamespaces = konfig.ConfigAnnoDomain + "/previousNamespaces"
	BuildAnnotationsRefBy             = konfig.ConfigAnnoDomain + "/refBy"
	BuildAnnotationsGenBehavior       = konfig.ConfigAnnoDomain + "/generatorBehavior"
	BuildAnnotationsGenAddHashSuffix  = konfig.ConfigAnnoDomain + "/needsHashSuffix"

	// the following are only for patches, to specify whether they can change names
	// and kinds of their targets
	BuildAnnotationAllowNameChange = konfig.ConfigAnnoDomain + "/allowNameChange"
	BuildAnnotationAllowKindChange = konfig.ConfigAnnoDomain + "/allowKindChange"

	OriginAnnotation = "config.kubernetes.io/origin"

	Enabled = "enabled"
)

Variables

This section is empty.

Functions

func IsErrTimeout

func IsErrTimeout(err error) bool

func MakeResIds added in v0.8.11

func MakeResIds(n *yaml.RNode) ([]resid.ResId, error)

MakeResIds returns all of an RNode's current and previous Ids

func NewErrTimeOut

func NewErrTimeOut(d time.Duration, c string) errTimeOut

func PathSplitter added in v0.6.9

func PathSplitter(path string, delimiter string) []string

PathSplitter splits a delimited string, permitting escaped delimiters.

func PrevIds added in v0.8.11

func PrevIds(n *yaml.RNode) ([]resid.ResId, error)

PrevIds returns all of an RNode's previous Ids

func SameEndingSubSlice added in v0.8.11

func SameEndingSubSlice(shortest, longest []string) bool

SameEndingSubSlice returns true if the slices end the same way, e.g. {"a", "b", "c"}, {"b", "c"} => true {"a", "b", "c"}, {"a", "b"} => false If one slice is empty and the other is not, return false.

func SmarterPathSplitter added in v0.8.11

func SmarterPathSplitter(path string, delimiter string) []string

SmarterPathSplitter splits a path, retaining bracketed elements. If the element is a list entry identifier (defined by the '='), it will retain the brackets. E.g. "[name=com.foo.someapp]" survives as one thing after splitting "spec.template.spec.containers.[name=com.foo.someapp].image" See kyaml/yaml/match.go for use of list entry identifiers. If the element is a mapping entry identifier, it will remove the brackets. E.g. "a.b.c" survives as one thing after splitting "metadata.annotations.[a.b.c] This function uses `PathSplitter`, so it also respects escaped delimiters.

func StringSliceContains added in v0.8.11

func StringSliceContains(slice []string, str string) bool

StringSliceContains returns true if the slice has the string.

func StringSliceIndex added in v0.8.11

func StringSliceIndex(slice []string, str string) int

StringSliceIndex returns the index of the str, else -1.

func TimedCall

func TimedCall(description string, d time.Duration, fn func() error) error

TimedCall runs fn, failing if it doesn't complete in the given duration. The description is used in the timeout error message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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