• k8s-merge-robot's avatar
    Merge pull request #24344 from derekwaynecarr/kubelet-lifecycle-callouts · 16159b8b
    k8s-merge-robot authored
    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 
    16159b8b
Name
Last commit
Last update
..
doc.go Loading commit data...
fake_handler_runner.go Loading commit data...
handlers.go Loading commit data...
handlers_test.go Loading commit data...
interfaces.go Loading commit data...