MCPcopy Create free account
hub / github.com/Azure/draft / getValues

Function getValues

pkg/safeguards/preprocessing/preprocessing_helpers.go:14–28  ·  view source on GitHub ↗

Returns values from values.yaml and release options specified in values.yaml

(chart *chart.Chart, valuesPath string, opt chartutil.ReleaseOptions, dirName string)

Source from the content-addressed store, hash-verified

12
13// Returns values from values.yaml and release options specified in values.yaml
14func getValues(chart *chart.Chart, valuesPath string, opt chartutil.ReleaseOptions, dirName string) (chartutil.Values, error) {
15 // Load values file
16 valuesFile, err := os.ReadFile(valuesPath)
17 if err != nil {
18 return nil, fmt.Errorf("failed to read values file: %s", err)
19 }
20
21 vals := map[string]interface{}{}
22 if err := yaml.Unmarshal(valuesFile, &vals); err != nil {
23 return nil, fmt.Errorf("failed to parse values.yaml: %s", err)
24 }
25
26 mergedValues, err := getReleaseOptions(chart, vals, opt, dirName)
27 return mergedValues, err
28}
29
30// Extracts release options from either CLI flags, values.yaml, or name of containing directory
31func getReleaseOptions(chart *chart.Chart, vals map[string]interface{}, opt chartutil.ReleaseOptions, dirName string) (chartutil.Values, error) {

Callers 1

RenderHelmChartFunction · 0.85

Calls 2

getReleaseOptionsFunction · 0.85
ReadFileMethod · 0.65

Tested by

no test coverage detected