mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
address comments
This commit is contained in:
@@ -42,13 +42,13 @@ var _ transformers.Transformer = &pruneTransformer{}
|
||||
|
||||
// NewPruneTransformer makes a pruneTransformer.
|
||||
func NewPruneTransformer(p *types.Prune, namespace string, append bool) transformers.Transformer {
|
||||
if p == nil || p.Type != "alphaConfigMap" || p.AlphaConfigMap.Namespace != namespace {
|
||||
if p == nil || p.Type != "ConfigMap" || p.ConfigMap.Namespace != namespace {
|
||||
return transformers.NewNoOpTransformer()
|
||||
}
|
||||
return &pruneTransformer{
|
||||
append: append,
|
||||
cmName: p.AlphaConfigMap.Name,
|
||||
cmNamespace: p.AlphaConfigMap.Namespace,
|
||||
cmName: p.ConfigMap.Name,
|
||||
cmNamespace: p.ConfigMap.Namespace,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,8 +140,8 @@ func TestPruneTransformer(t *testing.T) {
|
||||
}
|
||||
|
||||
p := &types.Prune{
|
||||
Type: "alphaConfigMap",
|
||||
AlphaConfigMap: types.NameArgs{
|
||||
Type: "ConfigMap",
|
||||
ConfigMap: types.NameArgs{
|
||||
Name: "pruneCM",
|
||||
Namespace: "default",
|
||||
},
|
||||
|
||||
@@ -85,7 +85,7 @@ func NewCmdBuild(
|
||||
"output", "o", "",
|
||||
"If specified, write the build output to this path.")
|
||||
|
||||
cmd.AddCommand(NewCmdBuildPrune(out, fs, rf, ptf, b))
|
||||
cmd.AddCommand(NewCmdBuildPrune(out, fs, rf, ptf, pc))
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -136,13 +136,13 @@ func (o *Options) RunBuild(
|
||||
func (o *Options) RunBuildPrune(
|
||||
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
|
||||
}
|
||||
@@ -166,11 +166,11 @@ func NewCmdBuildPrune(
|
||||
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{
|
||||
Use: "prune [path]",
|
||||
Use: "alpha-prune [path]",
|
||||
Short: "Print configmap to prune previous applied objects",
|
||||
Example: examples,
|
||||
SilenceUsage: true,
|
||||
@@ -179,7 +179,7 @@ func NewCmdBuildPrune(
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return o.RunBuildPrune(out, fs, rf, ptf, b)
|
||||
return o.RunBuildPrune(out, fs, rf, ptf, pc)
|
||||
},
|
||||
}
|
||||
return cmd
|
||||
|
||||
@@ -29,8 +29,8 @@ resources:
|
||||
- secret.yaml
|
||||
|
||||
prune:
|
||||
type: alphaConfigMap
|
||||
alphaConfigMap:
|
||||
type: ConfigMap
|
||||
configMap:
|
||||
name: haha
|
||||
namespace: default
|
||||
|
||||
|
||||
@@ -294,8 +294,8 @@ type KVSource struct {
|
||||
}
|
||||
|
||||
type Prune struct {
|
||||
Type string `json:"type,omitempty" yaml:"type,omitempty"`
|
||||
AlphaConfigMap NameArgs `json:"alphaConfigMap,omitempty" yaml:"alphaConfigMap,omitempty"`
|
||||
Type string `json:"type,omitempty" yaml:"type,omitempty"`
|
||||
ConfigMap NameArgs `json:"configMap,omitempty" yaml:"configMap,omitempty"`
|
||||
}
|
||||
|
||||
type NameArgs struct {
|
||||
|
||||
Reference in New Issue
Block a user