Documentation
¶
Index ¶
- Constants
- func Extract(raw interface{}) (map[string]manifest.Manifest, error)
- func Filter(list manifest.List, exprs Matchers) manifest.List
- func Label(list manifest.List, cfg v1alpha1.Environment) (manifest.List, error)
- func Namespace(list manifest.List, def string) manifest.List
- func Process(cfg v1alpha1.Environment, exprs Matchers) (manifest.List, error)
- func ResourceDefaults(list manifest.List, cfg v1alpha1.Environment) manifest.List
- func Sort(list manifest.List)
- func Unwrap(manifests map[string]manifest.Manifest) error
- type ErrBadExpr
- type ErrorPrimitiveReached
- type Ignorer
- type Matcher
- type Matchers
- type NegMatcher
Constants ¶
const ( MetadataPrefix = "tanka.dev" LabelEnvironment = MetadataPrefix + "/environment" // AnnotationPruneIgnore excludes a resource from `tk prune`, even if it // carries the tanka.dev/environment label and looks orphaned. This is for // resources that a third-party operator generates from a Tanka-managed // object (e.g. a Secret created by external-secrets from an // ExternalSecret), which can inherit the environment label and // last-applied-configuration annotation from their parent without ever // being applied by Tanka itself. AnnotationPruneIgnore = MetadataPrefix + "/prune-ignore" )
const ( // AnnotationNamespaced can be set on any resource to override the decision // whether 'metadata.namespace' is set by Tanka AnnotationNamespaced = MetadataPrefix + "/namespaced" )
Variables ¶
This section is empty.
Functions ¶
func Extract ¶
Extract scans the raw Jsonnet evaluation result (JSON tree) for objects that look like Kubernetes objects and extracts those into a flat map, indexed by their path in the original JSON tree
func Filter ¶
Filter returns all elements of the list that match at least one expression and are not ignored
func Namespace ¶
Namespace injects the default namespace of the environment into each resources, that does not already define one. AnnotationNamespaced can be used to disable this per resource
func Process ¶
Process converts the raw Jsonnet evaluation result (JSON tree) into a flat list of Kubernetes objects, also applying some transformations: - tanka.dev/** labels - filtering - best-effort sorting
func ResourceDefaults ¶ added in v0.12.0
Types ¶
type ErrBadExpr ¶
type ErrBadExpr struct {
// contains filtered or unexported fields
}
ErrBadExpr occurs when the regexp compiling fails
func (ErrBadExpr) Error ¶
func (e ErrBadExpr) Error() string
type ErrorPrimitiveReached ¶
type ErrorPrimitiveReached struct {
// contains filtered or unexported fields
}
ErrorPrimitiveReached occurs when walkJSON reaches the end of nested dicts without finding a valid Kubernetes manifest
func (ErrorPrimitiveReached) Error ¶
func (e ErrorPrimitiveReached) Error() string
func (ErrorPrimitiveReached) WithContainingObj ¶ added in v0.25.0
func (e ErrorPrimitiveReached) WithContainingObj(obj objx.Map, err error) ErrorPrimitiveReached
type Matcher ¶
Matcher is a single filter expression. The passed argument of Matcher is of the form `kind/name` (manifest.KindName())
type Matchers ¶
type Matchers []Matcher
Matchers is a collection of multiple expressions. A matcher may also implement Ignorer to explicitly ignore fields
func MustStrExps ¶
func (Matchers) IgnoreString ¶ added in v0.12.0
func (Matchers) KindsFor ¶ added in v0.39.0
KindsFor returns the set of resource kinds that positive matchers in the collection target. It is used to restrict cluster API queries to only the resource types relevant to the filter set, avoiding the cost of listing every resource type when only a few are needed.
Returns (kinds, true) when all positive matchers specify a single literal kind (e.g. "statefulset/.*" → "StatefulSet"). Returns (nil, false) when kind restriction cannot be determined — either because no positive matchers exist, a matcher uses regex metacharacters in the kind position, or the matcher type is not a compiled regexp. Callers should query all resource kinds when ok is false.
func (Matchers) MatchString ¶
MatchString returns whether at least one expression (OR) matches the string
type NegMatcher ¶ added in v0.12.0
type NegMatcher struct {
// contains filtered or unexported fields
}
NexMatcher is a matcher that inverts the original behaviour
func (NegMatcher) IgnoreString ¶ added in v0.12.0
func (n NegMatcher) IgnoreString(s string) bool
func (NegMatcher) MatchString ¶ added in v0.12.0
func (n NegMatcher) MatchString(_ string) bool