mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-12 18:18:51 +00:00
Automatic merge from submit-queue Define interfaces for kubelet pod admission and eviction There is too much code and logic in `kubelet.go` that makes it hard to test functions in discrete pieces. I propose an interface that an internal module can implement that will let it make an admission decision for a pod. If folks are ok with the pattern, I want to move the a) predicate checking, b) out of disk, c) eviction preventing best-effort pods being admitted into their own dedicated handlers that would be easier for us to mock test. We can then just write tests to ensure that the `Kubelet` calls a call-out, and we can write easier unit tests to ensure that dedicated handlers do the right thing. The second interface I propose was a `PodEvictor` that is invoked in the main kubelet sync loop to know if pods should be pro-actively evicted from the machine. The current active deadline check should move into a simple evictor implementation, and I want to plug the out of resource killer code path as an implementation of the same interface. @vishh @timothysc - if you guys can ack on this, I will add some unit testing to ensure we do the call-outs. /cc @kubernetes/sig-node @kubernetes/rh-cluster-infra