From 2dae73e3d9e11df820f81982c7ba8abe64dd32ba Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Fri, 5 Jul 2019 04:37:27 +0800 Subject: [PATCH] Populate DisruptedPods field for non-dry run --- pkg/registry/core/pod/storage/eviction.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/registry/core/pod/storage/eviction.go b/pkg/registry/core/pod/storage/eviction.go index 386244451b0..ef793846f0b 100644 --- a/pkg/registry/core/pod/storage/eviction.go +++ b/pkg/registry/core/pod/storage/eviction.go @@ -206,15 +206,15 @@ func (r *EvictionREST) checkAndDecrement(namespace string, podName string, pdb p } pdb.Status.PodDisruptionsAllowed-- - if pdb.Status.DisruptedPods == nil { - pdb.Status.DisruptedPods = make(map[string]metav1.Time) - } - // If this is a dry-run, we don't need to go any further than that. if dryRun == true { return nil } + if pdb.Status.DisruptedPods == nil { + pdb.Status.DisruptedPods = make(map[string]metav1.Time) + } + // Eviction handler needs to inform the PDB controller that it is about to delete a pod // so it should not consider it as available in calculations when updating PodDisruptions allowed. // If the pod is not deleted within a reasonable time limit PDB controller will assume that it won't