values

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Package values implements HelmRelease values resolution and Kustomization postBuild substitution. It is the bridge between authored manifests and rendered manifests: it consults the central Store for ConfigMap/Secret content and merges referenced data into a HelmRelease's values map or a Kustomization's postBuild substitution table.

Two key behaviors mirror flux-local:

  • Deep merge follows Helm semantics: nested maps are merged, but lists are REPLACED entirely (not concatenated).
  • When a valuesFrom reference is optional and the target ConfigMap / Secret (or values key) is missing, it is skipped silently so the render proceeds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepMergeInto

func DeepMergeInto(dst, override map[string]any) map[string]any

DeepMergeInto merges override into dst using Helm's merge semantics. Callers MUST own dst. Nested inputs remain read-only; non-colliding maps and lists may be borrowed by reference.

func ExpandPostBuildSubstituteReference

func ExpandPostBuildSubstituteReference(ks *manifest.Kustomization, p Provider) error

ExpandPostBuildSubstituteReference resolves referenced and authored inline substitutions.

func ExpandValueReferences

func ExpandValueReferences(
	hr *manifest.HelmRelease,
	provider Provider,
	cache *Cache,
) error

ExpandValueReferences resolves all spec.valuesFrom references on hr, merges them with hr.Values (inline values take precedence per Helm semantics), and writes the result back to hr.Values.

Honors ValuesReference.Optional: missing resources or values keys on Optional=true refs are skipped silently; Optional=false refs fail. Matches Flux helm-controller chartutil semantics.

Hard errors from the lookup itself — unsupported kind, malformed binaryData — always bubble up; they are unrelated to whether the ref is optional.

cache may be nil — tests and embedders without an orchestrator pass nil and pay the (small) per-ref yaml.Unmarshal cost. Orchestrators supply a Cache constructed at startup so refs shared across HRs (a common pattern for platform-wide values CMs) parse exactly once.

func NeedsSubstitution added in v0.7.3

func NeedsSubstitution(v any) bool

NeedsSubstitution reports expansion syntax or scalars requiring the Flux JSON conversion.

func ResolveStaticPath added in v0.7.3

func ResolveStaticPath(path string, parent *manifest.Kustomization, provider Provider) (string, bool)

ResolveStaticPath resolves a produced path from declared parent substitutions.

func SubstitutionDocument added in v0.7.3

func SubstitutionDocument(occurrence manifest.DocOccurrence, active bool) ([]byte, error)

SubstitutionDocument keeps YAML framing and document exclusions identical across callers.

func SubstitutionNames added in v0.7.3

func SubstitutionNames(data []byte) map[string]struct{}

SubstitutionNames derives effective names from Flux syntax, or nil for unproved syntax.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache memoizes valuesFrom YAML by content across HelmReleases. Stored maps are immutable; callers must clone before mutation or merge with copy-on-write. The zero value is ready for concurrent use. A nil *Cache disables memoization.

type DependencySubstitutions added in v0.7.3

type DependencySubstitutions struct {
	// contains filtered or unexported fields
}

DependencySubstitutions is an immutable snapshot of unambiguous discovered inline values.

func NewDependencySubstitutions added in v0.7.3

func NewDependencySubstitutions(kustomizations []*manifest.Kustomization) DependencySubstitutions

NewDependencySubstitutions captures agreeing inline declarations and excludes conflicting keys.

func (DependencySubstitutions) Equal added in v0.7.3

Equal compares immutable substitution content.

func (DependencySubstitutions) MarshalJSONTo added in v0.7.3

func (d DependencySubstitutions) MarshalJSONTo(encoder *jsontext.Encoder) error

MarshalJSONTo encodes immutable substitution content for renderer policy identity.

func (DependencySubstitutions) Resolve added in v0.7.3

func (d DependencySubstitutions) Resolve(text string) string

Resolve evaluates defaults and supplied values, retaining the input on evaluation errors.

type Provider

type Provider interface {
	Data(manifest.NamedResource) manifest.Data
}

Provider exposes lazy ConfigMap/Secret data by canonical identity.

type StoreProvider added in v0.7.3

type StoreProvider struct {
	// contains filtered or unexported fields
}

StoreProvider retains one execution's captured values and availability evidence.

func NewStoreProvider

func NewStoreProvider(s dataReader) *StoreProvider

NewStoreProvider returns one execution's captured values and availability evidence.

func (*StoreProvider) Data added in v0.7.3

Data returns the captured data for id.

func (*StoreProvider) Lookup added in v0.7.3

Lookup captures a values object and its materializers once for expansion and diagnostics.

Jump to

Keyboard shortcuts

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