values

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package values merges values the way Helm and Argo CD do and remembers where every key came from, so findings can point at a file and line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(v interface{}) interface{}

func CopyMap

func CopyMap(m map[string]interface{}) map[string]interface{}

func Delete

func Delete(m map[string]interface{}, path []string)

func Display

func Display(path []string) string

func Key

func Key(path []string) string

func Leaves

func Leaves(m map[string]interface{}, path []string, fn func(path []string, v interface{}))

Leaves calls fn for every leaf: scalars, lists, nulls and empty maps.

func Lookup

func Lookup(m map[string]interface{}, path []string) (interface{}, bool)

func Merge

func Merge(a, b map[string]interface{}) map[string]interface{}

Merge deep-merges b over a, the same way Helm merges -f files.

func Resolve

func Resolve(m map[string]interface{}, dotted string) ([]string, bool)

Resolve turns a dotted key typed by a user into a path inside m. Keys can contain dots themselves (e.g. label names), so segments are joined greedily until they match an existing key.

func SetPath

func SetPath(m map[string]interface{}, path []string, v interface{})

Types

type Origin

type Origin struct {
	File   string   `json:"file"`
	Line   int      `json:"line,omitempty"`
	IsFile bool     `json:"-"`
	Doc    int      `json:"-"`
	Prefix []string `json:"-"`
}

Origin is where a key was set: a values file and line, or a synthetic source such as "--set" or an Application's inline values. For values embedded in a manifest (a HelmRelease's spec.values), Doc is the YAML document inside File and Prefix the path of the values block in it.

type Set

type Set struct {
	Values  map[string]interface{}
	Sources []string
	// contains filtered or unexported fields
}

func New

func New() *Set

func (*Set) AddAt

func (s *Set) AddAt(path []string, v interface{}, origin Origin)

AddAt places data's values under path, like Flux valuesFrom targetPath.

func (*Set) AddAttributed

func (s *Set) AddAttributed(m map[string]interface{}, label string, attribute func(path []string) []Origin)

AddAttributed merges m with origins computed per key, for values whose final content comes from a kustomize build but whose keys can be traced back to the files that define them.

func (*Set) AddFile

func (s *Set) AddFile(path string) error

func (*Set) AddMap

func (s *Set) AddMap(m map[string]interface{}, origin string)

func (*Set) AddNode

func (s *Set) AddNode(n *yaml.Node, file string, doc int, prefix []string) error

AddNode merges a values block embedded in a manifest, such as a HelmRelease's spec.values. n must come from parsing the whole file so its line numbers are the file's.

func (*Set) AddSet

func (s *Set) AddSet(expr, origin string, forceString bool) error

AddSet applies a `--set` style expression on top of the current values.

func (*Set) AddYAML

func (s *Set) AddYAML(data []byte, origin string) error

func (*Set) ExactOrigins

func (s *Set) ExactOrigins(path []string) []Origin

ExactOrigins returns only the places that set path itself.

func (*Set) Origins

func (s *Set) Origins(path []string) []Origin

Origins returns every place that set path, falling back to the closest ancestor when the exact key was set as part of a larger value.

func (*Set) ValuesFiles

func (s *Set) ValuesFiles() []string

ValuesFiles returns the sources that are plain values files: files that several apps can load as a whole, unlike values embedded in a manifest.

Jump to

Keyboard shortcuts

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