mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Better error message on undefined loader behavior.
This commit is contained in:
@@ -34,7 +34,8 @@ type Loader struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewLoader(
|
func NewLoader(
|
||||||
pc *types.PluginConfig, rf *resmap.Factory, fs filesys.FileSystem) *Loader {
|
pc *types.PluginConfig, rf *resmap.Factory, fs filesys.FileSystem,
|
||||||
|
) *Loader {
|
||||||
return &Loader{pc: pc, rf: rf, fs: fs}
|
return &Loader{pc: pc, rf: rf, fs: fs}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +59,8 @@ func (l *Loader) Config() *types.PluginConfig {
|
|||||||
|
|
||||||
func (l *Loader) LoadGenerators(
|
func (l *Loader) LoadGenerators(
|
||||||
ldr ifc.Loader, v ifc.Validator, rm resmap.ResMap) (
|
ldr ifc.Loader, v ifc.Validator, rm resmap.ResMap) (
|
||||||
result []*resmap.GeneratorWithProperties, err error) {
|
result []*resmap.GeneratorWithProperties, err error,
|
||||||
|
) {
|
||||||
for _, res := range rm.Resources() {
|
for _, res := range rm.Resources() {
|
||||||
g, err := l.LoadGenerator(ldr, v, res)
|
g, err := l.LoadGenerator(ldr, v, res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -74,7 +76,8 @@ func (l *Loader) LoadGenerators(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *Loader) LoadGenerator(
|
func (l *Loader) LoadGenerator(
|
||||||
ldr ifc.Loader, v ifc.Validator, res *resource.Resource) (resmap.Generator, error) {
|
ldr ifc.Loader, v ifc.Validator, res *resource.Resource,
|
||||||
|
) (resmap.Generator, error) {
|
||||||
c, err := l.loadAndConfigurePlugin(ldr, v, res)
|
c, err := l.loadAndConfigurePlugin(ldr, v, res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -87,7 +90,8 @@ func (l *Loader) LoadGenerator(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *Loader) LoadTransformers(
|
func (l *Loader) LoadTransformers(
|
||||||
ldr ifc.Loader, v ifc.Validator, rm resmap.ResMap) ([]*resmap.TransformerWithProperties, error) {
|
ldr ifc.Loader, v ifc.Validator, rm resmap.ResMap,
|
||||||
|
) ([]*resmap.TransformerWithProperties, error) {
|
||||||
var result []*resmap.TransformerWithProperties
|
var result []*resmap.TransformerWithProperties
|
||||||
for _, res := range rm.Resources() {
|
for _, res := range rm.Resources() {
|
||||||
t, err := l.LoadTransformer(ldr, v, res)
|
t, err := l.LoadTransformer(ldr, v, res)
|
||||||
@@ -104,7 +108,8 @@ func (l *Loader) LoadTransformers(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *Loader) LoadTransformer(
|
func (l *Loader) LoadTransformer(
|
||||||
ldr ifc.Loader, v ifc.Validator, res *resource.Resource) (*resmap.TransformerWithProperties, error) {
|
ldr ifc.Loader, v ifc.Validator, res *resource.Resource,
|
||||||
|
) (*resmap.TransformerWithProperties, error) {
|
||||||
c, err := l.loadAndConfigurePlugin(ldr, v, res)
|
c, err := l.loadAndConfigurePlugin(ldr, v, res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -179,7 +184,8 @@ func isBuiltinPlugin(res *resource.Resource) bool {
|
|||||||
func (l *Loader) loadAndConfigurePlugin(
|
func (l *Loader) loadAndConfigurePlugin(
|
||||||
ldr ifc.Loader,
|
ldr ifc.Loader,
|
||||||
v ifc.Validator,
|
v ifc.Validator,
|
||||||
res *resource.Resource) (c resmap.Configurable, err error) {
|
res *resource.Resource,
|
||||||
|
) (c resmap.Configurable, err error) {
|
||||||
if isBuiltinPlugin(res) {
|
if isBuiltinPlugin(res) {
|
||||||
switch l.pc.BpLoadingOptions {
|
switch l.pc.BpLoadingOptions {
|
||||||
case types.BploLoadFromFileSys:
|
case types.BploLoadFromFileSys:
|
||||||
@@ -192,7 +198,7 @@ func (l *Loader) loadAndConfigurePlugin(
|
|||||||
c, err = l.makeBuiltinPlugin(res.GetGvk())
|
c, err = l.makeBuiltinPlugin(res.GetGvk())
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf(
|
err = fmt.Errorf(
|
||||||
"unknown plugin loader behavior specified: %v",
|
"unknown plugin loader behavior specified: %s %v", res.GetGvk().String(),
|
||||||
l.pc.BpLoadingOptions)
|
l.pc.BpLoadingOptions)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -282,4 +288,3 @@ func (l *Loader) loadExecOrGoPlugin(resId resid.ResId) (resmap.Configurable, err
|
|||||||
}
|
}
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user