mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-14 10:30:59 +00:00
Cleanup plugin builds.
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
||||
"sigs.k8s.io/kustomize/pkg/pgmconfig"
|
||||
"sigs.k8s.io/kustomize/pkg/resmap"
|
||||
"sigs.k8s.io/kustomize/pkg/target"
|
||||
"sigs.k8s.io/kustomize/pkg/types"
|
||||
)
|
||||
|
||||
// Options contain the options for running a build
|
||||
@@ -63,7 +64,7 @@ func NewCmdBuild(
|
||||
out io.Writer, fs fs.FileSystem,
|
||||
rf *resmap.Factory,
|
||||
ptf transformer.Factory,
|
||||
b bool) *cobra.Command {
|
||||
pc *types.PluginConfig) *cobra.Command {
|
||||
var o Options
|
||||
|
||||
cmd := &cobra.Command{
|
||||
@@ -76,7 +77,7 @@ func NewCmdBuild(
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return o.RunBuild(out, fs, rf, ptf, b)
|
||||
return o.RunBuild(out, fs, rf, ptf, pc)
|
||||
},
|
||||
}
|
||||
cmd.Flags().StringVarP(
|
||||
@@ -104,13 +105,13 @@ func (o *Options) Validate(args []string) error {
|
||||
func (o *Options) RunBuild(
|
||||
out io.Writer, fSys fs.FileSystem,
|
||||
rf *resmap.Factory, ptf transformer.Factory,
|
||||
b bool) error {
|
||||
pc *types.PluginConfig) error {
|
||||
ldr, err := loader.NewLoader(o.kustomizationPath, fSys)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer ldr.Cleanup()
|
||||
kt, err := target.NewKustTarget(ldr, rf, ptf, b)
|
||||
kt, err := target.NewKustTarget(ldr, rf, ptf, pc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ package commands
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"sigs.k8s.io/kustomize/pkg/pgmconfig"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/k8sdeps/kunstruct"
|
||||
@@ -31,6 +30,7 @@ import (
|
||||
"sigs.k8s.io/kustomize/pkg/commands/edit"
|
||||
"sigs.k8s.io/kustomize/pkg/commands/misc"
|
||||
"sigs.k8s.io/kustomize/pkg/fs"
|
||||
"sigs.k8s.io/kustomize/pkg/pgmconfig"
|
||||
"sigs.k8s.io/kustomize/pkg/resmap"
|
||||
"sigs.k8s.io/kustomize/pkg/resource"
|
||||
"sigs.k8s.io/kustomize/pkg/types"
|
||||
@@ -50,25 +50,26 @@ See https://sigs.k8s.io/kustomize
|
||||
`,
|
||||
}
|
||||
|
||||
// Configuration for ConfigMap and Secret generators.
|
||||
genMetaArgs := types.GeneratorMetaArgs{
|
||||
PluginConfig: plugin.DefaultPluginConfig(),
|
||||
}
|
||||
pluginConfig := plugin.DefaultPluginConfig()
|
||||
|
||||
c.PersistentFlags().BoolVar(
|
||||
&genMetaArgs.PluginConfig.GoEnabled,
|
||||
&pluginConfig.GoEnabled,
|
||||
plugin.EnableGoPluginsFlagName,
|
||||
false, plugin.EnableGoPluginsFlagHelp)
|
||||
// Not advertising this alpha feature.
|
||||
c.PersistentFlags().MarkHidden(plugin.EnableGoPluginsFlagName)
|
||||
|
||||
// Configuration for ConfigMap and Secret generators.
|
||||
genMetaArgs := types.GeneratorMetaArgs{
|
||||
PluginConfig: pluginConfig,
|
||||
}
|
||||
uf := kunstruct.NewKunstructuredFactoryWithGeneratorArgs(&genMetaArgs)
|
||||
|
||||
c.AddCommand(
|
||||
build.NewCmdBuild(
|
||||
stdOut, fSys,
|
||||
resmap.NewFactory(resource.NewFactory(uf)),
|
||||
transformer.NewFactoryImpl(), genMetaArgs.PluginConfig.GoEnabled),
|
||||
transformer.NewFactoryImpl(), pluginConfig),
|
||||
edit.NewCmdEdit(fSys, validator.NewKustValidator(), uf),
|
||||
misc.NewCmdConfig(fSys),
|
||||
misc.NewCmdVersion(stdOut),
|
||||
|
||||
Reference in New Issue
Block a user