volume scheduler: introduce special string type

This makes it possible to search for the special strings more easily
(https://github.com/kubernetes/kubernetes/pull/88230#discussion_r382367043).
This commit is contained in:
Patrick Ohly
2020-02-25 11:10:27 +01:00
parent 6eb0b034ac
commit 6329b17d2f
7 changed files with 42 additions and 31 deletions

View File

@@ -67,18 +67,18 @@ func TestVolumeBinding(t *testing.T) {
pod: &v1.Pod{Spec: volState},
node: &v1.Node{},
volumeBinderConfig: &volumescheduling.FakeVolumeBinderConfig{
FindReasons: []string{volumescheduling.ErrReasonBindConflict},
FindReasons: []volumescheduling.ConflictReason{volumescheduling.ErrReasonBindConflict},
},
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, volumescheduling.ErrReasonBindConflict),
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, string(volumescheduling.ErrReasonBindConflict)),
},
{
name: "bound and unbound unsatisfied",
pod: &v1.Pod{Spec: volState},
node: &v1.Node{},
volumeBinderConfig: &volumescheduling.FakeVolumeBinderConfig{
FindReasons: []string{volumescheduling.ErrReasonBindConflict, volumescheduling.ErrReasonNodeConflict},
FindReasons: []volumescheduling.ConflictReason{volumescheduling.ErrReasonBindConflict, volumescheduling.ErrReasonNodeConflict},
},
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, volumescheduling.ErrReasonBindConflict, volumescheduling.ErrReasonNodeConflict),
wantStatus: framework.NewStatus(framework.UnschedulableAndUnresolvable, string(volumescheduling.ErrReasonBindConflict), string(volumescheduling.ErrReasonNodeConflict)),
},
{
name: "unbound/found matches/bind succeeds",