Description
Forked from #137. /cc @dchen1107
Client-initiated terminations are triggered by DELETE via the API. As discussed in #137, I'd like clients to be able to pass in arbitrary termination reasons, to facilitate ecosystem management extensions, as well as user-provided reasons.
I suggest a URL parameter on DELETE: ?reason=MYREASON.
The apiserver would record this as the termination reason, regardless what Kubelet reported when the termination actually occurred.
Once we generate termination events, the reason should be visible there.
We plan to pass termination reasons to lifecycle hooks (#1445). This means we'll need a way to pass the reason to Kubelet. I suggest implementing a "deletion dance", which we've also talked about doing in the apiserver: rather than actually deleting objects, we should first put them into a deleting/terminated state, so that clients can observe their final state. The reason could be passed this way.
Of course, objects eventually need to be deleted, and there's always a chance that some clients may not have observed the final state. We still need to handle that, but we should ensure it doesn't happen often. Think of this as a declarative graceful termination.
See also #1370.