update PruneString for resources

This commit is contained in:
Jingfang Liu
2019-04-18 10:39:22 -07:00
parent 867201a075
commit 748c88c276
4 changed files with 10 additions and 16 deletions

View File

@@ -59,11 +59,12 @@ func NewPruneTransformer(p *types.Prune, namespace string, append bool) transfor
// which is proposed in https://github.com/kubernetes/enhancements/pull/810
func (o *pruneTransformer) Transform(m resmap.ResMap) error {
keys := []string{}
for id, r := range m {
s := id.PruneString()
for _, r := range m {
s := r.PruneString()
keys = append(keys, s)
for _, refid := range r.GetRefBy() {
keys = append(keys, s+"---"+refid.PruneString())
ref := m[refid]
keys = append(keys, s+"---"+ref.PruneString())
}
}
h, err := hash.SortArrayAndComputeHash(keys)

View File

@@ -54,8 +54,7 @@ func makeResMap() resmap.ResMap {
}),
resid.NewResId(deploy, "deploy1"): rf.FromMap(
map[string]interface{}{
"group": "apps",
"apiVersion": "v1",
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": map[string]interface{}{
"name": "deploy1",