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