What would you like to be cleaned:
Calling PatchAdmissionStatus can currently lead to subtle bugs, when the function fails on error, because the object passed to the function is modified.
To achieve that we could have a new helper dedicated to Workloads which, say workload.PatchStatus:
- takes an internal DeepCopy of the workload
- calls PatchAdmissionStatus or another helper
- updates the workload pointer pass to invoke the function on success
- discards the changes in case of failure
Alternatively, return the new version of the object on succeessful request (but this is more code changes).
Why is this needed:
To avoid modifying the cached valued of the Workload in case the update fails. This inconsistency may result in subtle issues.