diff --git a/Gopkg.lock b/Gopkg.lock index e1d0d54886..3803e56fa4 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -203,7 +203,8 @@ version = "1.1.4" [[projects]] - digest = "1:dbf8cf42233bd9e45479e210f4e21e1139f90ee6d4683bdb13df77c53f06015e" + branch = "release-0.4" + digest = "1:e9ad5f6b6e8e2b261432d0e8bdb7a7edef7526b7428ccdf5d5040b96e58bae66" name = "github.com/kubernetes-sigs/kube-batch" packages = [ "cmd/kube-batch/app", @@ -219,17 +220,30 @@ "pkg/client/informers/externalversions/scheduling/v1alpha1", "pkg/client/listers/scheduling/v1alpha1", "pkg/scheduler", + "pkg/scheduler/actions", + "pkg/scheduler/actions/allocate", + "pkg/scheduler/actions/backfill", + "pkg/scheduler/actions/preempt", + "pkg/scheduler/actions/reclaim", "pkg/scheduler/api", "pkg/scheduler/api/helpers", "pkg/scheduler/cache", "pkg/scheduler/conf", "pkg/scheduler/framework", "pkg/scheduler/metrics", + "pkg/scheduler/plugins", + "pkg/scheduler/plugins/conformance", + "pkg/scheduler/plugins/drf", + "pkg/scheduler/plugins/gang", + "pkg/scheduler/plugins/nodeorder", + "pkg/scheduler/plugins/predicates", + "pkg/scheduler/plugins/priority", + "pkg/scheduler/plugins/proportion", + "pkg/scheduler/util", "pkg/version", ] pruneopts = "UT" - revision = "ba47bbbbd95185404cd1aa4ce8653e7bd60ab096" - version = "v0.4.2" + revision = "4ec1cce0e5f8a4309bed32f9feff0fc1dadffe9f" [[projects]] digest = "1:ff5ebae34cfbf047d505ee150de27e60570e8c394b3b8fdbb720ff6ac71985fc" @@ -1033,12 +1047,14 @@ "github.com/kubernetes-sigs/kube-batch/pkg/client/informers/externalversions", "github.com/kubernetes-sigs/kube-batch/pkg/client/informers/externalversions/scheduling/v1alpha1", "github.com/kubernetes-sigs/kube-batch/pkg/client/listers/scheduling/v1alpha1", + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions", "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/api", "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/api/helpers", "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/cache", "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/conf", "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/framework", "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/metrics", + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins", "github.com/onsi/ginkgo", "github.com/onsi/gomega", "github.com/spf13/cobra", @@ -1062,6 +1078,7 @@ "k8s.io/apimachinery/pkg/util/runtime", "k8s.io/apimachinery/pkg/util/strategicpatch", "k8s.io/apimachinery/pkg/util/uuid", + "k8s.io/apimachinery/pkg/util/validation", "k8s.io/apimachinery/pkg/util/wait", "k8s.io/apimachinery/pkg/watch", "k8s.io/apiserver/pkg/util/flag", diff --git a/Gopkg.toml b/Gopkg.toml index 09673f8097..7f10a5160c 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -38,7 +38,7 @@ required = [ [[constraint]] name = "github.com/kubernetes-sigs/kube-batch" - version = "0.4.2" + branch = "release-0.4" [[constraint]] name = "github.com/onsi/ginkgo" diff --git a/cmd/scheduler/main.go b/cmd/scheduler/main.go index 79624a2d4a..06867e3909 100644 --- a/cmd/scheduler/main.go +++ b/cmd/scheduler/main.go @@ -26,8 +26,8 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apiserver/pkg/util/flag" - _ "volcano.sh/volcano/pkg/scheduler/actions" - _ "volcano.sh/volcano/pkg/scheduler/plugins" + _ "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions" + _ "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins" "github.com/kubernetes-sigs/kube-batch/cmd/kube-batch/app" "github.com/kubernetes-sigs/kube-batch/cmd/kube-batch/app/options" diff --git a/pkg/scheduler/README.md b/pkg/scheduler/README.md deleted file mode 100644 index 2a7bb58590..0000000000 --- a/pkg/scheduler/README.md +++ /dev/null @@ -1,4 +0,0 @@ -## Volcano Scheduler - -Currently, Volcano scheduler duplicated actions/plugins from [kube-batch](https://github.com/kubernetes-sigs/kube-batch) -which focus on batch workload in Kubernetes. Expect the framework part of kube-batch can be migrated to the upstream. diff --git a/pkg/scheduler/actions/allocate/allocate_test.go b/pkg/scheduler/actions/allocate/allocate_test.go deleted file mode 100644 index a1b3304b64..0000000000 --- a/pkg/scheduler/actions/allocate/allocate_test.go +++ /dev/null @@ -1,310 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package allocate - -import ( - "fmt" - - "reflect" - "sync" - "testing" - "time" - - "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/types" - "k8s.io/client-go/tools/record" - - kbv1 "github.com/kubernetes-sigs/kube-batch/pkg/apis/scheduling/v1alpha1" - "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/api" - "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/cache" - "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/conf" - "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/framework" - - "volcano.sh/volcano/pkg/scheduler/plugins/drf" - "volcano.sh/volcano/pkg/scheduler/plugins/proportion" -) - -func buildResourceList(cpu string, memory string) v1.ResourceList { - return v1.ResourceList{ - v1.ResourceCPU: resource.MustParse(cpu), - v1.ResourceMemory: resource.MustParse(memory), - api.GPUResourceName: resource.MustParse("0"), - } -} - -func buildResourceListWithGPU(cpu string, memory string, GPU string) v1.ResourceList { - return v1.ResourceList{ - v1.ResourceCPU: resource.MustParse(cpu), - v1.ResourceMemory: resource.MustParse(memory), - api.GPUResourceName: resource.MustParse(GPU), - } -} - -func buildNode(name string, alloc v1.ResourceList, labels map[string]string) *v1.Node { - return &v1.Node{ - ObjectMeta: metav1.ObjectMeta{ - Name: name, - Labels: labels, - }, - Status: v1.NodeStatus{ - Capacity: alloc, - Allocatable: alloc, - }, - } -} - -func buildPod(ns, n, nn string, p v1.PodPhase, req v1.ResourceList, groupName string, labels map[string]string, selector map[string]string) *v1.Pod { - return &v1.Pod{ - ObjectMeta: metav1.ObjectMeta{ - UID: types.UID(fmt.Sprintf("%v-%v", ns, n)), - Name: n, - Namespace: ns, - Labels: labels, - Annotations: map[string]string{ - kbv1.GroupNameAnnotationKey: groupName, - }, - }, - Status: v1.PodStatus{ - Phase: p, - }, - Spec: v1.PodSpec{ - NodeName: nn, - NodeSelector: selector, - Containers: []v1.Container{ - { - Resources: v1.ResourceRequirements{ - Requests: req, - }, - }, - }, - }, - } -} - -type fakeBinder struct { - sync.Mutex - binds map[string]string - c chan string -} - -func (fb *fakeBinder) Bind(p *v1.Pod, hostname string) error { - fb.Lock() - defer fb.Unlock() - - key := fmt.Sprintf("%v/%v", p.Namespace, p.Name) - fb.binds[key] = hostname - - fb.c <- key - - return nil -} - -type fakeStatusUpdater struct { -} - -func (ftsu *fakeStatusUpdater) UpdatePodCondition(pod *v1.Pod, podCondition *v1.PodCondition) (*v1.Pod, error) { - // do nothing here - return nil, nil -} - -func (ftsu *fakeStatusUpdater) UpdatePodGroup(pg *kbv1.PodGroup) (*kbv1.PodGroup, error) { - // do nothing here - return nil, 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) - defer framework.CleanupPluginBuilders() - - tests := []struct { - name string - podGroups []*kbv1.PodGroup - pods []*v1.Pod - nodes []*v1.Node - queues []*kbv1.Queue - expected map[string]string - }{ - { - name: "one Job with two Pods on one node", - podGroups: []*kbv1.PodGroup{ - { - ObjectMeta: metav1.ObjectMeta{ - Name: "pg1", - Namespace: "c1", - }, - Spec: kbv1.PodGroupSpec{ - Queue: "c1", - }, - }, - }, - pods: []*v1.Pod{ - buildPod("c1", "p1", "", v1.PodPending, buildResourceList("1", "1G"), "pg1", make(map[string]string), make(map[string]string)), - buildPod("c1", "p2", "", v1.PodPending, buildResourceList("1", "1G"), "pg1", make(map[string]string), make(map[string]string)), - }, - nodes: []*v1.Node{ - buildNode("n1", buildResourceList("2", "4Gi"), make(map[string]string)), - }, - queues: []*kbv1.Queue{ - { - ObjectMeta: metav1.ObjectMeta{ - Name: "c1", - }, - Spec: kbv1.QueueSpec{ - Weight: 1, - }, - }, - }, - expected: map[string]string{ - "c1/p1": "n1", - "c1/p2": "n1", - }, - }, - { - name: "two Jobs on one node", - podGroups: []*kbv1.PodGroup{ - { - ObjectMeta: metav1.ObjectMeta{ - Name: "pg1", - Namespace: "c1", - }, - Spec: kbv1.PodGroupSpec{ - Queue: "c1", - }, - }, - { - ObjectMeta: metav1.ObjectMeta{ - Name: "pg2", - Namespace: "c2", - }, - Spec: kbv1.PodGroupSpec{ - Queue: "c2", - }, - }, - }, - - pods: []*v1.Pod{ - // pending pod with owner1, under c1 - buildPod("c1", "p1", "", v1.PodPending, buildResourceList("1", "1G"), "pg1", make(map[string]string), make(map[string]string)), - // pending pod with owner1, under c1 - buildPod("c1", "p2", "", v1.PodPending, buildResourceList("1", "1G"), "pg1", make(map[string]string), make(map[string]string)), - // pending pod with owner2, under c2 - buildPod("c2", "p1", "", v1.PodPending, buildResourceList("1", "1G"), "pg2", make(map[string]string), make(map[string]string)), - // pending pod with owner, under c2 - buildPod("c2", "p2", "", v1.PodPending, buildResourceList("1", "1G"), "pg2", make(map[string]string), make(map[string]string)), - }, - nodes: []*v1.Node{ - buildNode("n1", buildResourceList("2", "4G"), make(map[string]string)), - }, - queues: []*kbv1.Queue{ - { - ObjectMeta: metav1.ObjectMeta{ - Name: "c1", - }, - Spec: kbv1.QueueSpec{ - Weight: 1, - }, - }, - { - ObjectMeta: metav1.ObjectMeta{ - Name: "c2", - }, - Spec: kbv1.QueueSpec{ - Weight: 1, - }, - }, - }, - expected: map[string]string{ - "c2/p1": "n1", - "c1/p1": "n1", - }, - }, - } - - allocate := New() - - for i, test := range tests { - binder := &fakeBinder{ - binds: map[string]string{}, - 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, - StatusUpdater: &fakeStatusUpdater{}, - VolumeBinder: &fakeVolumeBinder{}, - - Recorder: record.NewFakeRecorder(100), - } - for _, node := range test.nodes { - schedulerCache.AddNode(node) - } - for _, pod := range test.pods { - schedulerCache.AddPod(pod) - } - - for _, ss := range test.podGroups { - schedulerCache.AddPodGroup(ss) - } - - for _, q := range test.queues { - schedulerCache.AddQueue(q) - } - - ssn := framework.OpenSession(schedulerCache, []conf.Tier{ - { - Plugins: []conf.PluginOption{ - { - Name: "drf", - }, - { - Name: "proportion", - }, - }, - }, - }) - defer framework.CloseSession(ssn) - - allocate.Execute(ssn) - - for i := 0; i < len(test.expected); i++ { - select { - case <-binder.c: - case <-time.After(3 * time.Second): - t.Errorf("Failed to get binding request.") - } - } - - if !reflect.DeepEqual(test.expected, binder.binds) { - t.Errorf("case %d (%s): expected: %v, got %v ", i, test.name, test.expected, binder.binds) - } - } -} diff --git a/pkg/scheduler/actions/preempt/preempt_test.go b/pkg/scheduler/actions/preempt/preempt_test.go deleted file mode 100644 index f6b677ac94..0000000000 --- a/pkg/scheduler/actions/preempt/preempt_test.go +++ /dev/null @@ -1,32 +0,0 @@ -/* -Copyright 2018 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package preempt - -import ( - "testing" - - "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/framework" - - "volcano.sh/volcano/pkg/scheduler/plugins/drf" -) - -func TestPreempt(t *testing.T) { - framework.RegisterPluginBuilder("drf", drf.New) - defer framework.CleanupPluginBuilders() - - // TODO (k82cn): Add UT cases here. -} diff --git a/vendor/github.com/kubernetes-sigs/kube-batch/cmd/kube-batch/app/options/options.go b/vendor/github.com/kubernetes-sigs/kube-batch/cmd/kube-batch/app/options/options.go index dd7c24fff1..21e62b28c8 100644 --- a/vendor/github.com/kubernetes-sigs/kube-batch/cmd/kube-batch/app/options/options.go +++ b/vendor/github.com/kubernetes-sigs/kube-batch/cmd/kube-batch/app/options/options.go @@ -42,8 +42,11 @@ type ServerOption struct { DefaultQueue string PrintVersion bool ListenAddress string + EnablePriorityClass bool } +var ServerOpts *ServerOption + // NewServerOption creates a new CMServer with a default config. func NewServerOption() *ServerOption { s := ServerOption{} @@ -65,6 +68,8 @@ func (s *ServerOption) AddFlags(fs *pflag.FlagSet) { fs.BoolVar(&s.PrintVersion, "version", false, "Show version and quit") fs.StringVar(&s.LockObjectNamespace, "lock-object-namespace", s.LockObjectNamespace, "Define the namespace of the lock object") fs.StringVar(&s.ListenAddress, "listen-address", defaultListenAddress, "The address to listen on for HTTP requests.") + fs.BoolVar(&s.EnablePriorityClass, "priority-class", true, + "Enable PriorityClass to provide the capacity of preemption at pod group level; to disable it, set it false") } func (s *ServerOption) CheckOptionOrDie() error { @@ -74,3 +79,7 @@ func (s *ServerOption) CheckOptionOrDie() error { return nil } + +func (s *ServerOption) RegisterOptions() { + ServerOpts = s +} diff --git a/pkg/scheduler/actions/allocate/allocate.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/allocate/allocate.go similarity index 98% rename from pkg/scheduler/actions/allocate/allocate.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/allocate/allocate.go index c601ef868a..912d20bb72 100644 --- a/pkg/scheduler/actions/allocate/allocate.go +++ b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/allocate/allocate.go @@ -21,8 +21,7 @@ import ( "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/api" "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/framework" - - "volcano.sh/volcano/pkg/scheduler/util" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/util" ) type allocateAction struct { diff --git a/pkg/scheduler/actions/backfill/backfill.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/backfill/backfill.go similarity index 100% rename from pkg/scheduler/actions/backfill/backfill.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/backfill/backfill.go diff --git a/pkg/scheduler/actions/factory.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/factory.go similarity index 74% rename from pkg/scheduler/actions/factory.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/factory.go index cbc8439fdf..827533b226 100644 --- a/pkg/scheduler/actions/factory.go +++ b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/factory.go @@ -19,10 +19,10 @@ package actions import ( "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/framework" - "volcano.sh/volcano/pkg/scheduler/actions/allocate" - "volcano.sh/volcano/pkg/scheduler/actions/backfill" - "volcano.sh/volcano/pkg/scheduler/actions/preempt" - "volcano.sh/volcano/pkg/scheduler/actions/reclaim" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/allocate" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/backfill" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/preempt" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/reclaim" ) func init() { diff --git a/pkg/scheduler/actions/preempt/preempt.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/preempt/preempt.go similarity index 99% rename from pkg/scheduler/actions/preempt/preempt.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/preempt/preempt.go index c0b6e06f35..57e0dd4173 100644 --- a/pkg/scheduler/actions/preempt/preempt.go +++ b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/preempt/preempt.go @@ -24,8 +24,7 @@ import ( "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/api" "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/framework" "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/metrics" - - "volcano.sh/volcano/pkg/scheduler/util" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/util" ) type preemptAction struct { diff --git a/pkg/scheduler/actions/reclaim/reclaim.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/reclaim/reclaim.go similarity index 98% rename from pkg/scheduler/actions/reclaim/reclaim.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/reclaim/reclaim.go index b6d877db61..83ae3a1af8 100644 --- a/pkg/scheduler/actions/reclaim/reclaim.go +++ b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/actions/reclaim/reclaim.go @@ -21,8 +21,7 @@ import ( "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/api" "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/framework" - - "volcano.sh/volcano/pkg/scheduler/util" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/util" ) type reclaimAction struct { diff --git a/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/cache/cache.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/cache/cache.go index f4941cb341..442e4dfb54 100644 --- a/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/cache/cache.go +++ b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/cache/cache.go @@ -44,6 +44,7 @@ import ( podutil "k8s.io/kubernetes/pkg/api/v1/pod" "k8s.io/kubernetes/pkg/scheduler/volumebinder" + "github.com/kubernetes-sigs/kube-batch/cmd/kube-batch/app/options" "github.com/kubernetes-sigs/kube-batch/pkg/apis/scheduling/v1alpha1" kbver "github.com/kubernetes-sigs/kube-batch/pkg/client/clientset/versioned" "github.com/kubernetes-sigs/kube-batch/pkg/client/clientset/versioned/scheme" @@ -304,7 +305,10 @@ func (sc *SchedulerCache) Run(stopCh <-chan struct{}) { go sc.pvcInformer.Informer().Run(stopCh) go sc.scInformer.Informer().Run(stopCh) go sc.queueInformer.Informer().Run(stopCh) - go sc.pcInformer.Informer().Run(stopCh) + + if options.ServerOpts.EnablePriorityClass { + go sc.pcInformer.Informer().Run(stopCh) + } // Re-sync error tasks. go wait.Until(sc.processResyncTask, 0, stopCh) @@ -316,15 +320,22 @@ func (sc *SchedulerCache) Run(stopCh <-chan struct{}) { func (sc *SchedulerCache) WaitForCacheSync(stopCh <-chan struct{}) bool { return cache.WaitForCacheSync(stopCh, - sc.pdbInformer.Informer().HasSynced, - sc.podInformer.Informer().HasSynced, - sc.podGroupInformer.Informer().HasSynced, - sc.nodeInformer.Informer().HasSynced, - sc.pvInformer.Informer().HasSynced, - sc.pvcInformer.Informer().HasSynced, - sc.scInformer.Informer().HasSynced, - sc.queueInformer.Informer().HasSynced, - sc.pcInformer.Informer().HasSynced, + func() []cache.InformerSynced { + informerSynced := []cache.InformerSynced{ + sc.pdbInformer.Informer().HasSynced, + sc.podInformer.Informer().HasSynced, + sc.podGroupInformer.Informer().HasSynced, + sc.nodeInformer.Informer().HasSynced, + sc.pvInformer.Informer().HasSynced, + sc.pvcInformer.Informer().HasSynced, + sc.scInformer.Informer().HasSynced, + sc.queueInformer.Informer().HasSynced, + } + if options.ServerOpts.EnablePriorityClass { + informerSynced = append(informerSynced, sc.pcInformer.Informer().HasSynced) + } + return informerSynced + }()..., ) } diff --git a/pkg/scheduler/plugins/conformance/conformance.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/conformance/conformance.go similarity index 100% rename from pkg/scheduler/plugins/conformance/conformance.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/conformance/conformance.go diff --git a/pkg/scheduler/plugins/drf/drf.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/drf/drf.go similarity index 100% rename from pkg/scheduler/plugins/drf/drf.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/drf/drf.go diff --git a/pkg/scheduler/plugins/factory.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/factory.go similarity index 69% rename from pkg/scheduler/plugins/factory.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/factory.go index 193a42e034..331b9db09f 100644 --- a/pkg/scheduler/plugins/factory.go +++ b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/factory.go @@ -19,13 +19,13 @@ package plugins import ( "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/framework" - "volcano.sh/volcano/pkg/scheduler/plugins/conformance" - "volcano.sh/volcano/pkg/scheduler/plugins/drf" - "volcano.sh/volcano/pkg/scheduler/plugins/gang" - "volcano.sh/volcano/pkg/scheduler/plugins/nodeorder" - "volcano.sh/volcano/pkg/scheduler/plugins/predicates" - "volcano.sh/volcano/pkg/scheduler/plugins/priority" - "volcano.sh/volcano/pkg/scheduler/plugins/proportion" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/conformance" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/drf" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/gang" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/nodeorder" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/predicates" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/priority" + "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/proportion" ) func init() { diff --git a/pkg/scheduler/plugins/gang/gang.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/gang/gang.go similarity index 100% rename from pkg/scheduler/plugins/gang/gang.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/gang/gang.go diff --git a/pkg/scheduler/plugins/nodeorder/nodeorder.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/nodeorder/nodeorder.go similarity index 100% rename from pkg/scheduler/plugins/nodeorder/nodeorder.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/nodeorder/nodeorder.go diff --git a/pkg/scheduler/plugins/predicates/predicates.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/predicates/predicates.go similarity index 100% rename from pkg/scheduler/plugins/predicates/predicates.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/predicates/predicates.go diff --git a/pkg/scheduler/plugins/priority/priority.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/priority/priority.go similarity index 100% rename from pkg/scheduler/plugins/priority/priority.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/priority/priority.go diff --git a/pkg/scheduler/plugins/proportion/proportion.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/proportion/proportion.go similarity index 100% rename from pkg/scheduler/plugins/proportion/proportion.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/plugins/proportion/proportion.go diff --git a/pkg/scheduler/util/priority_queue.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/util/priority_queue.go similarity index 100% rename from pkg/scheduler/util/priority_queue.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/util/priority_queue.go diff --git a/pkg/scheduler/util/sort.go b/vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/util/sort.go similarity index 100% rename from pkg/scheduler/util/sort.go rename to vendor/github.com/kubernetes-sigs/kube-batch/pkg/scheduler/util/sort.go