Manage name changes (prefix/suffix) via YAML annotations rather than via in-memory-only fields.

This commit is contained in:
Natasha Sarkar
2021-01-11 13:06:21 -08:00
parent ea5d08bac5
commit bd4580d73a
34 changed files with 539 additions and 61 deletions

View File

@@ -589,6 +589,7 @@ func (m *resWrangler) ApplySmPatch(
patchCopy.SetName(res.GetName())
patchCopy.SetNamespace(res.GetNamespace())
patchCopy.SetGvk(res.GetGvk())
patchCopy.SetOriginalName(res.GetOriginalName(), true)
err := res.ApplySmPatch(patchCopy)
if err != nil {
// Check for an error string from UnmarshalJSON that's indicative
@@ -619,3 +620,13 @@ func (m *resWrangler) ApplySmPatch(
m.AppendAll(newRm)
return nil
}
func (m *resWrangler) RemoveIdAnnotations() error {
for _, r := range m.Resources() {
err := r.RemoveIdAnnotations()
if err != nil {
return err
}
}
return nil
}