Use patch for snapshot-controller when there are no finalizers

- Also address PR feedback re: avoid a deepCopy for annotations patch

Signed-off-by: Grant Griffiths <ggriffiths@purestorage.com>
This commit is contained in:
Grant Griffiths
2021-09-29 16:23:42 -07:00
parent 0ccf801780
commit d14e2eea8f
3 changed files with 20 additions and 29 deletions

View File

@@ -354,12 +354,6 @@ func (r *snapshotReactor) React(action core.Action) (handled bool, ret runtime.O
storedVer, _ := strconv.Atoi(storedSnapshot.ResourceVersion)
storedSnapshot.ResourceVersion = strconv.Itoa(storedVer + 1)
// // If we were updating annotations and the new annotations are nil, leave as empty.
// // This seems to be the behavior for merge-patching nil & empty annotations
// if !reflect.DeepEqual(storedSnapshotContent.Annotations, content.Annotations) && content.Annotations == nil {
// content.Annotations = make(map[string]string)
// }
} else {
return true, nil, fmt.Errorf("cannot update snapshot %s: snapshot not found", action.GetName())
}