mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 16:42:51 +00:00
Reuse tansformer codes
This commit is contained in:
@@ -140,11 +140,6 @@ func (p *ExecPlugin) Transform(rm resmap.ResMap) error {
|
||||
return p.updateResMapValues(output, rm)
|
||||
}
|
||||
|
||||
func (p *ExecPlugin) Validate(rm resmap.ResMap) error {
|
||||
// Validate works exactly same with Transformer
|
||||
return p.Transform(rm)
|
||||
}
|
||||
|
||||
// invokePlugin writes plugin config to a temp file, then
|
||||
// passes the full temp file path as the first arg to a process
|
||||
// running the plugin binary. Process output is returned.
|
||||
|
||||
@@ -87,32 +87,6 @@ func (l *Loader) LoadTransformer(
|
||||
return t, nil
|
||||
}
|
||||
|
||||
func (l *Loader) LoadValidators(
|
||||
ldr ifc.Loader, v ifc.Validator, rm resmap.ResMap) ([]resmap.Validator, error) {
|
||||
var result []resmap.Validator
|
||||
for _, res := range rm.Resources() {
|
||||
t, err := l.LoadValidator(ldr, v, res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result = append(result, t)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (l *Loader) LoadValidator(
|
||||
ldr ifc.Loader, v ifc.Validator, res *resource.Resource) (resmap.Validator, error) {
|
||||
c, err := l.loadAndConfigurePlugin(ldr, v, res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
t, ok := c.(resmap.Validator)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("plugin %s not a validator", res.OrgId())
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
func relativePluginPath(id resid.ResId) string {
|
||||
return filepath.Join(
|
||||
id.Group,
|
||||
|
||||
Reference in New Issue
Block a user