About PreStop hook for Daemonset

Let me propose a new feature for Kubernetes Daemonset resource.

Currently, Kubernetes Daemonset does not support PreStop lifecycle hook, in my recognition. I understand Daemonset is designed to run on every node. However, this sometimes bothers us when we want Daemonset to do some tasks before the scale-in of nodes.

For example, there is one Daemonset that does some batch jobs for pods running at the same node. Then, the cluster did the scale-out by cluster-autoscaler, and some minutes later, did the scale-in. In this case, we want to guarantee that the last job of the Daemonset finished successfully, and to achieve that, we want to run the PreStop hook. However, unfortunately, this requirement is not easy in the current Kubernetes version. Kubernetes’ scale-in process kills Daemonset pods instantly without PreStop hook. Replicaset’s pods are terminated correctly though.

I understand Daemonset is guaranteed to run on each node, so doing the termination process for Daemonset before stopping a node creates a paradox by definition.

Nevertheless, I believe Daemonset should be processed by PreStop hook when stopping a node.

Let me hear your opinion.