Documentation
¶
Overview ¶
Package matrix expands a module's openapi value schema into many concrete value combinations ("variants"). A single default render only exercises one branch of a chart's templates; matrix mode renders every combination so that conditionally-rendered resources (guarded by feature flags, modes, enums, etc.) are produced and linted too.
Axes of variation are discovered from the module's own openapi schema:
- a node carrying x-examples contributes one variant per example;
- an enum contributes one variant per allowed value;
- a boolean contributes true and false.
Combinations are the cartesian product of all axes, capped by a limit. When the product exceeds the limit, an all-pairs (pairwise) set is produced instead so that every pair of axis values still co-occurs in some variant — enough to reach bugs that need two conditions at once (e.g. "feature enabled" AND "mode = Static").
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
Generate returns a lazy sequence of value variants to render for the module at modulePath, using valuesFile (e.g. "values.yaml") as the openapi values schema, along with the total number of variants the sequence will yield. The first variant is always the default (no overrides), so matrix output is a superset of a normal lint. At most limit combinations are produced.
The sequence is lazy on purpose: a module whose schema expands to millions of combinations would exhaust memory if every override tree were materialized up front, so each variant's overrides are built only as it is consumed. The returned count is computed without materializing anything (a cheap product for the cartesian case, the pairwise set size otherwise), so callers can log it before iterating.
Types ¶
type Variant ¶
type Variant struct {
// Overrides is the .Values override tree ({camelName: {...}}); nil for the
// default variant.
Overrides chartutil.Values
// Label is a short human-readable description of what this variant sets.
Label string
}
Variant is a set of value overrides to render, structured as the chart's .Values tree (i.e. keyed by the camel-cased module name). A nil/empty Variant means "render with the default generated values".