|
|
@ -26,20 +26,13 @@ import (
|
|
|
|
"helm.sh/helm/v4/pkg/lint/support"
|
|
|
|
"helm.sh/helm/v4/pkg/lint/support"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Values lints a chart's values.yaml file.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// This function is deprecated and will be removed in Helm 4.
|
|
|
|
|
|
|
|
func Values(linter *support.Linter) {
|
|
|
|
|
|
|
|
ValuesWithOverrides(linter, map[string]interface{}{})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ValuesWithOverrides tests the values.yaml file.
|
|
|
|
// ValuesWithOverrides tests the values.yaml file.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// If a schema is present in the chart, values are tested against that. Otherwise,
|
|
|
|
// If a schema is present in the chart, values are tested against that. Otherwise,
|
|
|
|
// they are only tested for well-formedness.
|
|
|
|
// they are only tested for well-formedness.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// If additional values are supplied, they are coalesced into the values in values.yaml.
|
|
|
|
// If additional values are supplied, they are coalesced into the values in values.yaml.
|
|
|
|
func ValuesWithOverrides(linter *support.Linter, values map[string]interface{}) {
|
|
|
|
func ValuesWithOverrides(linter *support.Linter, valueOverrides map[string]interface{}) {
|
|
|
|
file := "values.yaml"
|
|
|
|
file := "values.yaml"
|
|
|
|
vf := filepath.Join(linter.ChartDir, file)
|
|
|
|
vf := filepath.Join(linter.ChartDir, file)
|
|
|
|
fileExists := linter.RunLinterRule(support.InfoSev, file, validateValuesFileExistence(vf))
|
|
|
|
fileExists := linter.RunLinterRule(support.InfoSev, file, validateValuesFileExistence(vf))
|
|
|
@ -48,7 +41,7 @@ func ValuesWithOverrides(linter *support.Linter, values map[string]interface{})
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
linter.RunLinterRule(support.ErrorSev, file, validateValuesFile(vf, values))
|
|
|
|
linter.RunLinterRule(support.ErrorSev, file, validateValuesFile(vf, valueOverrides))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func validateValuesFileExistence(valuesPath string) error {
|
|
|
|
func validateValuesFileExistence(valuesPath string) error {
|
|
|
|