|
|
|
@ -146,6 +146,7 @@ func Templates(linter *support.Linter, values map[string]interface{}, namespace
|
|
|
|
|
linter.RunLinterRule(support.WarningSev, fpath, validateNoDeprecations(yamlStruct))
|
|
|
|
|
|
|
|
|
|
linter.RunLinterRule(support.ErrorSev, fpath, validateMatchSelector(yamlStruct, renderedContent))
|
|
|
|
|
linter.RunLinterRule(support.ErrorSev, fpath, validateListAnnotations(yamlStruct, renderedContent))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -293,6 +294,28 @@ func validateMatchSelector(yamlStruct *K8sYamlStruct, manifest string) error {
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
func validateListAnnotations(yamlStruct *K8sYamlStruct, manifest string) error {
|
|
|
|
|
if yamlStruct.Kind == "List" {
|
|
|
|
|
m := struct {
|
|
|
|
|
Items []struct {
|
|
|
|
|
Metadata struct {
|
|
|
|
|
Annotations map[string]string
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}{}
|
|
|
|
|
|
|
|
|
|
if err := yaml.Unmarshal([]byte(manifest), &m); err != nil {
|
|
|
|
|
return validateYamlContent(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, i := range m.Items {
|
|
|
|
|
if _, ok := i.Metadata.Annotations["helm.sh/resource-policy"]; ok {
|
|
|
|
|
return errors.New("Annotation 'helm.sh/resource-policy' within List objects are ignored")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// K8sYamlStruct stubs a Kubernetes YAML file.
|
|
|
|
|
//
|
|
|
|
|