support strategic merge patch with $patch: delete

This commit is contained in:
jingfangliu
2019-07-24 12:46:33 -07:00
parent ffd95ef5a9
commit fc78917191
4 changed files with 50 additions and 1 deletions

View File

@@ -71,6 +71,14 @@ func (p *plugin) Transform(m resmap.ResMap) error {
if err != nil {
return err
}
// remove the resource from resmap
// when the patch is to $patch: delete that target
if len(target.Map()) == 0 {
err = m.Remove(target.CurId())
if err != nil {
return err
}
}
}
return nil
}