I'll admit that restarting failed pods is a bit of a strange thing to do and we should talk about whether we want to do that.
To keep things clean and avoid bugs, the old goal was to start with a (mostly) fresh PodStatus when restarting a pod. That's still a pretty good goal. Here we copy over the last unitState into LastTerminatedState when restarting a failed pod. That data will be preserved for the user to query until the pod is restarted. Keeping that data around shouldn't cause any issues in the controller.
I'll admit that restarting failed pods is a bit of a strange thing to do and we should talk about whether we want to do that.
To keep things clean and avoid bugs, the old goal was to start with a (mostly) fresh PodStatus when restarting a pod. That's still a pretty good goal. Here we copy over the last unitState into LastTerminatedState when restarting a failed pod. That data will be preserved for the user to query until the pod is restarted. Keeping that data around shouldn't cause any issues in the controller.