Bug 1841187

Summary: [Descheduler] - Log messages printed in cluster logs when dry run mode enabled for scheduler could be confusing
Product: OpenShift Container Platform Reporter: RamaKasturi <knarra>
Component: kube-schedulerAssignee: Mike Dame <mdame>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.5CC: aos-bugs, mfojtik, yinzhou
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Certain Descheduler strategies printed eviction notifications whether in dry run or not Consequence: Confusion in logs as to whether the pod was actually evicted Fix: Remove redundant messages Result: Logs should be clearer now
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 16:01:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description RamaKasturi 2020-05-28 15:34:10 UTC
Description of problem:
When enabled RemovePodsViolatingInterPodAntiAffinity strategy cluster logs shows below 
I0528 09:23:48.664691       1 evictions.go:100] Evicted pod in dry run mode:
> "hello1-54d7977cd-l8wx7" in namespace "test"
> I0528 09:23:48.664700       1 pod_antiaffinity.go:50] Evicted pod:
> "hello1-54d7977cd-l8wx7"
>  because of existing anti-affinity
> 
When dry run is enabled two log messages are shown where in which first one
indicates it is a dry run but second one shows the pod is evicted, we should  just print one of them as this might be confusing for users

Version-Release number of selected component (if applicable):
4.5.0-0.nightly-2020-05-27-234738

How reproducible:
Always

Steps to Reproduce:
1. Install latest 4.5 cluster
2. Enable descheduler strategy RemovePodsViolatingInterPodAntiAffinity
3. Enable --dry-run flag for scheduler

Actual results:
When dry run is enabled two log messages are shown where in which first one
indicates it is a dry run but second one shows the pod is evicted, we should  just print one of them as this might be confusing for users
I0528 09:23:48.664691       1 evictions.go:100] Evicted pod in dry run mode:
> "hello1-54d7977cd-l8wx7" in namespace "test"
> I0528 09:23:48.664700       1 pod_antiaffinity.go:50] Evicted pod:
> "hello1-54d7977cd-l8wx7"
>  because of existing anti-affinity

Expected results:
Just print one message as below
> I0528 09:23:48.664700       1 pod_antiaffinity.go:50] Evicted pod in dry run mode "hello1-54d7977cd-l8wx7" because of existing anti-affinity


Additional info:

Comment 1 Mike Dame 2020-06-09 16:22:38 UTC
Upstream PR to fix this: https://github.com/kubernetes-sigs/descheduler/pull/319

Comment 5 RamaKasturi 2020-07-17 12:41:34 UTC
Currently blocked on verifying the bug due to https://bugzilla.redhat.com/show_bug.cgi?id=1858292, once resolved will verify it !!

Comment 6 zhou ying 2020-08-04 07:07:01 UTC
Checked with payload: 4.6.0-0.nightly-2020-08-04-002217, the issue has fixed:

oc logs -f po/cluster-68d8597f6b-m5zv4 |grep  testzy-2-dnzl8

I0804 07:01:47.932165       1 evictions.go:146] Evicted pod in dry run mode: "testzy-2-dnzl8" in namespace "zhouy" (InterPodAntiAffinity)
[root@dhcp-140-138 ~]# oc get csv
NAME                                                   DISPLAY                     VERSION                 REPLACES   PHASE
clusterkubedescheduleroperator.4.6.0-202008031851.p0   Kube Descheduler Operator   4.6.0-202008031851.p0              Succeeded

Comment 8 errata-xmlrpc 2020-10-27 16:01:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.6 GA Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4196