• Kubernetes Submit Queue's avatar
    Merge pull request #55957 from jsafrane/protection-predicate · 68c857e2
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue (batch tested with PRs 57211, 56150, 56368, 56271, 55957). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
    
    Skip pods that refer to PVCs that are being deleted
    
    **What this PR does / why we need it**:
    
    New check was added to `Schedule()` to make sure that a scheduled pod refers to existing PVCs that are not being deleted.
    
    In 1.9 we plan to add a new feature that uses finalizers on PVC to protect PVCs that are used by a running pod from being deleted. This finalizer will be removed when all pods that use a PVC are finished or deleted. See https://github.com/kubernetes/community/blob/master/contributors/design-proposals/storage/postpone-pvc-deletion-if-used-in-a-pod.md for details.
    
    I needed to pass `pvcLister` to `GenericScheduler`.
    
    UX:
    
    ```
    $ kubectl describe pod
    ...
      Type     Reason            Age              From               Message
      ----     ------            ----             ----               -------
      Warning  FailedScheduling  5s (x4 over 8s)  default-scheduler  persistentvolumeclaim "myclaim" is being deleted
      Warning  FailedScheduling  1s (x2 over 1s)  default-scheduler  persistentvolumeclaim "myclaim" not found
    
    ```
    
    
    **Release note**:
    
    ```release-note
    Scheduler skips pods that use a PVC that either does not exist or is being deleted.
    ```
    
    /sig scheduling
    /kind feature
    68c857e2
Name
Last commit
Last update
..
cmd/kube-scheduler Loading commit data...
pkg Loading commit data...
BUILD Loading commit data...
OWNERS Loading commit data...