Merge pull request #1004 from Liujingfang1/prune

change field name: prune -> inventory
This commit is contained in:
Kubernetes Prow Robot
2019-04-22 15:14:07 -07:00
committed by GitHub
10 changed files with 29 additions and 28 deletions

View File

@@ -178,8 +178,8 @@ func NewCmdBuildPrune(
var o Options
cmd := &cobra.Command{
Use: "alpha-prune [path]",
Short: "Print configmap to prune previous applied objects",
Use: "alpha-inventory [path]",
Short: "Print the inventory object which contains a list of all other objects",
Example: examples,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {

View File

@@ -69,7 +69,7 @@ func determineFieldOrder() []string {
"Configurations",
"Generators",
"Transformers",
"Prune",
"Inventory",
}
// Add deprecated fields here.

View File

@@ -48,7 +48,7 @@ func TestFieldOrder(t *testing.T) {
"Configurations",
"Generators",
"Transformers",
"Prune",
"Inventory",
}
actual := determineFieldOrder()
if len(expected) != len(actual) {

View File

@@ -27,5 +27,5 @@ import (
type Factory interface {
MakePatchTransformer(slice []*resource.Resource, rf *resource.Factory) (transformers.Transformer, error)
MakeHashTransformer() transformers.Transformer
MakePruneTransformer(p *types.Prune, namespace string, append bool) transformers.Transformer
MakeInventoryTransformer(p *types.Inventory, namespace string, append bool) transformers.Transformer
}

View File

@@ -147,7 +147,7 @@ func (kt *KustTarget) MakeCustomizedResMap() (resmap.ResMap, error) {
}
rm := ra.ResMap()
pt := kt.tFactory.MakePruneTransformer(kt.kustomization.Prune, kt.kustomization.Namespace, true)
pt := kt.tFactory.MakeInventoryTransformer(kt.kustomization.Inventory, kt.kustomization.Namespace, true)
err = pt.Transform(rm)
if err != nil {
return nil, err
@@ -177,7 +177,7 @@ func (kt *KustTarget) MakePruneConfigMap() (resmap.ResMap, error) {
}
rm := ra.ResMap()
pt := kt.tFactory.MakePruneTransformer(kt.kustomization.Prune, kt.kustomization.Namespace, false)
pt := kt.tFactory.MakeInventoryTransformer(kt.kustomization.Inventory, kt.kustomization.Namespace, false)
err = pt.Transform(rm)
if err != nil {
return nil, err

View File

@@ -28,7 +28,7 @@ resources:
- service.yaml
- secret.yaml
prune:
inventory:
type: ConfigMap
configMap:
name: haha

View File

@@ -137,8 +137,9 @@ type Kustomization struct {
// Transformers is a list of files containing transformers
Transformers []string `json:"transformers,omitempty" yaml:"transformers,omitempty"`
// Name of the ConfigMap used in Prune
Prune *Prune `json:"prune,omitempty" yaml:"prune:omitempty"`
// Inventory appends an object that contains the record
// of all other objects, which can be used in apply, prune and delete
Inventory *Inventory `json:"inventory,omitempty" yaml:"inventory:omitempty"`
}
// DealWithMissingFields fills the missing fields
@@ -293,7 +294,7 @@ type KVSource struct {
Args []string `json:"args,omitempty" yaml:"args,omitempty"`
}
type Prune struct {
type Inventory struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"`
ConfigMap NameArgs `json:"configMap,omitempty" yaml:"configMap,omitempty"`
}