MCPcopy
hub / github.com/helm/helm / LoadValues

Function LoadValues

pkg/chart/v2/loader/load.go:212–230  ·  view source on GitHub ↗

LoadValues loads values from a reader. The reader is expected to contain one or more YAML documents, the values of which are merged. And the values can be either a chart's default values or user-supplied values.

(data io.Reader)

Source from the content-addressed store, hash-verified

210// The reader is expected to contain one or more YAML documents, the values of which are merged.
211// And the values can be either a chart's default values or user-supplied values.
212func LoadValues(data io.Reader) (map[string]any, error) {
213 values := map[string]any{}
214 reader := utilyaml.NewYAMLReader(bufio.NewReader(data))
215 for {
216 currentMap := map[string]any{}
217 raw, err := reader.Read()
218 if err != nil {
219 if errors.Is(err, io.EOF) {
220 break
221 }
222 return nil, fmt.Errorf("error reading yaml document: %w", err)
223 }
224 if err := yaml.Unmarshal(raw, &currentMap); err != nil {
225 return nil, fmt.Errorf("cannot unmarshal yaml document: %w", err)
226 }
227 values = MergeMaps(values, currentMap)
228 }
229 return values, nil
230}
231
232// MergeMaps merges two maps. If a key exists in both maps, the value from b will be used.
233// If the value is a map, the maps will be merged recursively.

Callers 3

MergeValuesMethod · 0.92
TestLoadValuesFunction · 0.70
LoadFilesFunction · 0.70

Calls 3

IsMethod · 0.80
MergeMapsFunction · 0.70
ReadMethod · 0.45

Tested by 1

TestLoadValuesFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…