Skip to content

Commit

Permalink
Merge pull request kubernetes-retired#556 from k82cn/kb_555
Browse files Browse the repository at this point in the history
Added VolumeScheduling.
  • Loading branch information
k8s-ci-robot authored Jan 17, 2019
2 parents 5d22514 + c8fd127 commit a1016b2
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 81 deletions.
31 changes: 17 additions & 14 deletions pkg/scheduler/actions/allocate/allocate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"testing"
"time"

v1 "k8s.io/api/core/v1"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -95,14 +95,6 @@ func buildPod(ns, n, nn string, p v1.PodPhase, req v1.ResourceList, groupName st
}
}

func buildOwnerReference(owner string) metav1.OwnerReference {
controller := true
return metav1.OwnerReference{
Controller: &controller,
UID: types.UID(owner),
}
}

type fakeBinder struct {
sync.Mutex
binds map[string]string
Expand All @@ -129,6 +121,16 @@ func (ftsu *fakeTaskStatusUpdater) Update(pod *v1.Pod, podCondition *v1.PodCondi
return nil
}

type fakeVolumeBinder struct {
}

func (fvb *fakeVolumeBinder) AllocateVolumes(task *api.TaskInfo, hostname string) error {
return nil
}
func (fvb *fakeVolumeBinder) BindVolumes(task *api.TaskInfo) error {
return nil
}

func TestAllocate(t *testing.T) {
framework.RegisterPluginBuilder("drf", drf.New)
framework.RegisterPluginBuilder("proportion", proportion.New)
Expand Down Expand Up @@ -237,11 +239,12 @@ func TestAllocate(t *testing.T) {
c: make(chan string),
}
schedulerCache := &cache.SchedulerCache{
Nodes: make(map[string]*api.NodeInfo),
Jobs: make(map[api.JobID]*api.JobInfo),
Queues: make(map[api.QueueID]*api.QueueInfo),
Binder: binder,
TsUpdater: &fakeTaskStatusUpdater{},
Nodes: make(map[string]*api.NodeInfo),
Jobs: make(map[api.JobID]*api.JobInfo),
Queues: make(map[api.QueueID]*api.QueueInfo),
Binder: binder,
TaskStatusUpdater: &fakeTaskStatusUpdater{},
VolumeBinder: &fakeVolumeBinder{},
}
for _, node := range test.nodes {
schedulerCache.AddNode(node)
Expand Down
26 changes: 14 additions & 12 deletions pkg/scheduler/api/job_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ type TaskInfo struct {

Resreq *Resource

NodeName string
Status TaskStatus
Priority int32
NodeName string
Status TaskStatus
Priority int32
VolumeReady bool

Pod *v1.Pod
}
Expand Down Expand Up @@ -89,15 +90,16 @@ func NewTaskInfo(pod *v1.Pod) *TaskInfo {

func (ti *TaskInfo) Clone() *TaskInfo {
return &TaskInfo{
UID: ti.UID,
Job: ti.Job,
Name: ti.Name,
Namespace: ti.Namespace,
NodeName: ti.NodeName,
Status: ti.Status,
Priority: ti.Priority,
Pod: ti.Pod,
Resreq: ti.Resreq.Clone(),
UID: ti.UID,
Job: ti.Job,
Name: ti.Name,
Namespace: ti.Namespace,
NodeName: ti.NodeName,
Status: ti.Status,
Priority: ti.Priority,
Pod: ti.Pod,
Resreq: ti.Resreq.Clone(),
VolumeReady: ti.VolumeReady,
}
}

Expand Down
Loading

0 comments on commit a1016b2

Please sign in to comment.