mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Fix krm exec function working dir
This commit is contained in:
@@ -47,8 +47,18 @@ func (l *Loader) Config() *types.PluginConfig {
|
|||||||
return l.pc
|
return l.pc
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetWorkDir sets the working directory for this loader's plugins
|
// DeepCopyPluginConfig makes a full copy the actual values of PluginConfig.
|
||||||
func (l *Loader) SetWorkDir(wd string) {
|
func (l *Loader) DeepCopyPluginConfig() {
|
||||||
|
l.pc = &types.PluginConfig{
|
||||||
|
PluginRestrictions: l.pc.PluginRestrictions,
|
||||||
|
BpLoadingOptions: l.pc.BpLoadingOptions,
|
||||||
|
FnpLoadingOptions: l.pc.FnpLoadingOptions,
|
||||||
|
HelmConfig: l.pc.HelmConfig,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetPluginConfigWorkingDir sets the working directory for the loader's plugins.
|
||||||
|
func (l *Loader) SetPluginConfigWorkingDir(wd string) {
|
||||||
l.pc.FnpLoadingOptions.WorkingDir = wd
|
l.pc.FnpLoadingOptions.WorkingDir = wd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,3 +78,17 @@ func TestLoader(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLoaderSetPluginConfigWorkingDir(t *testing.T) {
|
||||||
|
p := provider.NewDefaultDepProvider()
|
||||||
|
rmF := resmap.NewFactory(p.GetResourceFactory())
|
||||||
|
fsys := filesys.MakeFsInMemory()
|
||||||
|
c := types.EnabledPluginConfig(types.BploLoadFromFileSys)
|
||||||
|
pLdr := NewLoader(c, rmF, fsys)
|
||||||
|
pLdrCopy := *pLdr
|
||||||
|
pLdrCopy.DeepCopyPluginConfig()
|
||||||
|
pLdrCopy.SetPluginConfigWorkingDir("/tmp/dummy")
|
||||||
|
if pLdrCopy.Config().FnpLoadingOptions.WorkingDir != "/tmp/dummy" {
|
||||||
|
t.Fatal("plugin working dir is not set correctly")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ func NewKustTarget(
|
|||||||
rFactory *resmap.Factory,
|
rFactory *resmap.Factory,
|
||||||
pLdr *loader.Loader) *KustTarget {
|
pLdr *loader.Loader) *KustTarget {
|
||||||
pLdrCopy := *pLdr
|
pLdrCopy := *pLdr
|
||||||
pLdrCopy.SetWorkDir(ldr.Root())
|
pLdrCopy.DeepCopyPluginConfig()
|
||||||
|
pLdrCopy.SetPluginConfigWorkingDir(ldr.Root())
|
||||||
|
|
||||||
return &KustTarget{
|
return &KustTarget{
|
||||||
ldr: ldr,
|
ldr: ldr,
|
||||||
validator: validator,
|
validator: validator,
|
||||||
|
|||||||
Reference in New Issue
Block a user