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

Function LoadValues

internal/chart/v3/loader/load.go:185–203  ·  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

183// The reader is expected to contain one or more YAML documents, the values of which are merged.
184// And the values can be either a chart's default values or user-supplied values.
185func LoadValues(data io.Reader) (map[string]any, error) {
186 values := map[string]any{}
187 reader := utilyaml.NewYAMLReader(bufio.NewReader(data))
188 for {
189 currentMap := map[string]any{}
190 raw, err := reader.Read()
191 if err != nil {
192 if errors.Is(err, io.EOF) {
193 break
194 }
195 return nil, fmt.Errorf("error reading yaml document: %w", err)
196 }
197 if err := yaml.Unmarshal(raw, &currentMap); err != nil {
198 return nil, fmt.Errorf("cannot unmarshal yaml document: %w", err)
199 }
200 values = MergeMaps(values, currentMap)
201 }
202 return values, nil
203}
204
205// MergeMaps merges two maps. If a key exists in both maps, the value from b will be used.
206// If the value is a map, the maps will be merged recursively.

Callers 2

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…