Merge pull request #68892 from ravisantoshgudimetla/fix-pdb

PDB checks should not be done for terminal pods while evicting
This commit is contained in:
k8s-ci-robot
2018-09-26 22:59:14 -07:00
committed by GitHub
2 changed files with 99 additions and 0 deletions

View File

@@ -86,6 +86,16 @@ func (r *EvictionREST) Create(ctx context.Context, obj runtime.Object, createVal
return nil, err
}
pod := obj.(*api.Pod)
// Evicting a terminal pod should result in direct deletion of pod as it already caused disruption by the time we are evicting.
// There is no need to check for pdb.
if pod.Status.Phase == api.PodSucceeded || pod.Status.Phase == api.PodFailed {
_, _, err = r.store.Delete(ctx, eviction.Name, eviction.DeleteOptions)
if err != nil {
return nil, err
}
return &metav1.Status{
Status: metav1.StatusSuccess}, nil
}
var rtStatus *metav1.Status
var pdbName string
err = retry.RetryOnConflict(EvictionsRetry, func() error {