engine

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package engine implements ordered Helm-values-style merging and provenance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Overrides

func Overrides(r *Result) []string

Overrides returns the leaf paths (not maps) that were assigned more than once, sorted. A map is assigned once per layer that touches any of its keys, so listing maps would only repeat their children.

func ParseSet

func ParseSet(expression string, stringValues bool) (map[string]any, error)

ParseSet parses a helm --set expression, or a --set-string expression when stringValues is true.

func SortedPaths

func SortedPaths(records map[string]*ValueRecord) []string

Types

type Assignment

type Assignment struct {
	Source    SourceLocation   `json:"source"`
	Value     any              `json:"value"`
	Kind      ValueKind        `json:"kind"`
	Action    AssignmentAction `json:"action"`
	Effective bool             `json:"effective"`
}

type AssignmentAction

type AssignmentAction string
const (
	ActionDefined               AssignmentAction = "defined"
	ActionOverridden            AssignmentAction = "overridden"
	ActionIdenticalRedefinition AssignmentAction = "identical-redefinition"
	ActionTypeChanged           AssignmentAction = "type-change"
)

type FileResult

type FileResult struct {
	File    string
	Changed bool
}

type Layer

type Layer struct {
	Name string
	Data []byte
}

Layer is one values file in merge order. Name is how sources refer to it: a path, or a template marked as rendered.

func ReadLayers

func ReadLayers(files []string) ([]Layer, error)

ReadLayers reads values files from disk into layers named by their path.

type Options

type Options struct{ Target, Application, Chart string }

type Result

type Result struct {
	Target      string
	Application string
	Chart       string
	Values      map[string]any
	Records     map[string]*ValueRecord
	Files       []FileResult
}

func Merge

func Merge(layers []Layer, setSources []SetSource, opts Options) (*Result, error)

Merge applies values layers in order, followed by set sources in order. Set sources therefore have higher precedence than every layer.

type SetSource

type SetSource struct {
	Expression   string
	Source       SourceLocation
	StringValues bool
}

SetSource is a Helm strvals expression with an explicit provenance label. StringValues matches Helm parameters, whose values are always strings.

func SetSources

func SetSources(expressions []string) []SetSource

SetSources turns user --set expressions into set sources labelled --set:N.

type SourceLocation

type SourceLocation struct {
	File   string `json:"file" yaml:"file"`
	Line   int    `json:"line" yaml:"line"`
	Column int    `json:"column" yaml:"column"`
}

type ValueID

type ValueID struct {
	Target      string `json:"target"`
	Application string `json:"application"`
	Chart       string `json:"chart"`
	Path        string `json:"path"`
}

type ValueKind

type ValueKind string
const (
	KindMap      ValueKind = "map"
	KindSequence ValueKind = "sequence"
	KindScalar   ValueKind = "scalar"
	KindNull     ValueKind = "null"
)

type ValueRecord

type ValueRecord struct {
	ID              ValueID        `json:"id"`
	EffectiveValue  any            `json:"effectiveValue"`
	EffectiveSource SourceLocation `json:"effectiveSource"`
	History         []Assignment   `json:"history"`
}

Jump to

Keyboard shortcuts

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