Returns values from values.yaml and release options specified in values.yaml
(chart *chart.Chart, valuesPath string, opt chartutil.ReleaseOptions, dirName string)
| 12 | |
| 13 | // Returns values from values.yaml and release options specified in values.yaml |
| 14 | func 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 |
| 31 | func getReleaseOptions(chart *chart.Chart, vals map[string]interface{}, opt chartutil.ReleaseOptions, dirName string) (chartutil.Values, error) { |
no test coverage detected