From 603a4e1931613978e0d73cd940e1ab3ee6d7ce1a Mon Sep 17 00:00:00 2001 From: Yibo Zhuang Date: Mon, 27 Sep 2021 15:02:35 -0700 Subject: [PATCH] Enhance ErrReasonPVNotExist in volumebinding scheduler plugin This change will make the message more clear when there is a case of PVC(s) bound to PV(s) that no longer exists and scheduler does not select the node due to this issue. Previous error message would look like: 0/2 nodes are available: 2 pvc(s) bound to non-existent pv(s) Updated message looks like: 0/2 nodes are available: 2 node(s) unavailable due to one or more pvc(s) bound to non-existent pv(s) For larger clusters with many different reasons of nodes that are not available, the current message can be very misleading for users to think that there are many PVCs lost due to PVs deleted but in fact it could be just a single PVC case but many nodes not selected by the scheduler due to this case. Signed-off By: Yibo Zhuang --- pkg/scheduler/framework/plugins/volumebinding/binder.go | 4 ++-- .../framework/plugins/volumebinding/volume_binding_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/scheduler/framework/plugins/volumebinding/binder.go b/pkg/scheduler/framework/plugins/volumebinding/binder.go index 54e98f2ffca..ca931b6e4cf 100644 --- a/pkg/scheduler/framework/plugins/volumebinding/binder.go +++ b/pkg/scheduler/framework/plugins/volumebinding/binder.go @@ -69,8 +69,8 @@ const ( ErrReasonNodeConflict ConflictReason = "node(s) had volume node affinity conflict" // ErrReasonNotEnoughSpace is used when a pod cannot start on a node because not enough storage space is available. ErrReasonNotEnoughSpace = "node(s) did not have enough free storage" - // ErrReasonPVNotExist is used when a PVC can't find the bound persistent volumes" - ErrReasonPVNotExist = "pvc(s) bound to non-existent pv(s)" + // ErrReasonPVNotExist is used when a pod has one or more PVC(s) bound to non-existent persistent volume(s)" + ErrReasonPVNotExist = "node(s) unavailable due to one or more pvc(s) bound to non-existent pv(s)" ) // BindingInfo holds a binding between PV and PVC. diff --git a/pkg/scheduler/framework/plugins/volumebinding/volume_binding_test.go b/pkg/scheduler/framework/plugins/volumebinding/volume_binding_test.go index caf22c72a89..883ef978dc9 100644 --- a/pkg/scheduler/framework/plugins/volumebinding/volume_binding_test.go +++ b/pkg/scheduler/framework/plugins/volumebinding/volume_binding_test.go @@ -260,7 +260,7 @@ func TestVolumeBinding(t *testing.T) { podVolumesByNode: map[string]*PodVolumes{}, }, wantFilterStatus: []*framework.Status{ - framework.NewStatus(framework.UnschedulableAndUnresolvable, `pvc(s) bound to non-existent pv(s)`), + framework.NewStatus(framework.UnschedulableAndUnresolvable, `node(s) unavailable due to one or more pvc(s) bound to non-existent pv(s)`), }, wantScores: []int64{ 0,