mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Add validation hook to template command execution
This commit is contained in:
@@ -392,6 +392,11 @@ type Defaulter interface {
|
||||
Default() error
|
||||
}
|
||||
|
||||
// Validator is implemented by APIs to have Validate invoked
|
||||
type Validator interface {
|
||||
Validate() error
|
||||
}
|
||||
|
||||
func (tc *TemplateCommand) doPreProcess(rl *ResourceList) error {
|
||||
// do any preprocessing
|
||||
if tc.PreProcess != nil {
|
||||
@@ -531,6 +536,12 @@ func (tc TemplateCommand) Execute(rl *ResourceList) error {
|
||||
}
|
||||
}
|
||||
|
||||
if v, ok := rl.FunctionConfig.(Validator); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := tc.doPreProcess(rl); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user