From 0420c8f048941b2e814635d7160ff1971e2edb31 Mon Sep 17 00:00:00 2001 From: sakeven Date: Wed, 30 Aug 2017 11:14:44 +0800 Subject: [PATCH] [Scheduler] regroup packages Signed-off-by: sakeven --- plugin/pkg/scheduler/algorithm/predicates/metadata.go | 6 ++++-- plugin/pkg/scheduler/algorithm/predicates/predicates.go | 3 ++- .../pkg/scheduler/algorithm/priorities/interpod_affinity.go | 3 ++- plugin/pkg/scheduler/algorithm/priorities/node_affinity.go | 3 ++- .../scheduler/algorithm/priorities/selector_spreading.go | 3 ++- .../pkg/scheduler/algorithm/priorities/taint_toleration.go | 3 ++- .../algorithmprovider/defaults/compatibility_test.go | 3 +-- plugin/pkg/scheduler/core/generic_scheduler.go | 3 ++- plugin/pkg/scheduler/factory/factory.go | 3 ++- plugin/pkg/scheduler/factory/plugins.go | 3 ++- plugin/pkg/scheduler/factory/plugins_test.go | 3 ++- plugin/pkg/scheduler/schedulercache/cache.go | 3 ++- plugin/pkg/scheduler/util/backoff_utils.go | 3 ++- plugin/pkg/scheduler/util/backoff_utils_test.go | 3 ++- 14 files changed, 29 insertions(+), 16 deletions(-) diff --git a/plugin/pkg/scheduler/algorithm/predicates/metadata.go b/plugin/pkg/scheduler/algorithm/predicates/metadata.go index 7289268f1ca..5f4ece5a24d 100644 --- a/plugin/pkg/scheduler/algorithm/predicates/metadata.go +++ b/plugin/pkg/scheduler/algorithm/predicates/metadata.go @@ -18,13 +18,15 @@ package predicates import ( "fmt" - "github.com/golang/glog" + "sync" + "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm" "k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache" schedutil "k8s.io/kubernetes/plugin/pkg/scheduler/util" - "sync" + + "github.com/golang/glog" ) type PredicateMetadataFactory struct { diff --git a/plugin/pkg/scheduler/algorithm/predicates/predicates.go b/plugin/pkg/scheduler/algorithm/predicates/predicates.go index bc1b05523d1..dc811b8e80f 100644 --- a/plugin/pkg/scheduler/algorithm/predicates/predicates.go +++ b/plugin/pkg/scheduler/algorithm/predicates/predicates.go @@ -23,7 +23,6 @@ import ( "sync" "time" - "github.com/golang/glog" "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -42,6 +41,8 @@ import ( "k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache" schedutil "k8s.io/kubernetes/plugin/pkg/scheduler/util" "k8s.io/metrics/pkg/client/clientset_generated/clientset" + + "github.com/golang/glog" ) // NodeInfo: Other types for predicate functions... diff --git a/plugin/pkg/scheduler/algorithm/priorities/interpod_affinity.go b/plugin/pkg/scheduler/algorithm/priorities/interpod_affinity.go index 489a530cbf4..7abe732d45c 100644 --- a/plugin/pkg/scheduler/algorithm/priorities/interpod_affinity.go +++ b/plugin/pkg/scheduler/algorithm/priorities/interpod_affinity.go @@ -20,7 +20,6 @@ import ( "strings" "sync" - "github.com/golang/glog" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/util/workqueue" @@ -30,6 +29,8 @@ import ( priorityutil "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/priorities/util" schedulerapi "k8s.io/kubernetes/plugin/pkg/scheduler/api" "k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache" + + "github.com/golang/glog" ) type InterPodAffinity struct { diff --git a/plugin/pkg/scheduler/algorithm/priorities/node_affinity.go b/plugin/pkg/scheduler/algorithm/priorities/node_affinity.go index b8a8077f349..1f62091042e 100644 --- a/plugin/pkg/scheduler/algorithm/priorities/node_affinity.go +++ b/plugin/pkg/scheduler/algorithm/priorities/node_affinity.go @@ -19,12 +19,13 @@ package priorities import ( "fmt" - "github.com/golang/glog" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" v1helper "k8s.io/kubernetes/pkg/api/v1/helper" schedulerapi "k8s.io/kubernetes/plugin/pkg/scheduler/api" "k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache" + + "github.com/golang/glog" ) // CalculateNodeAffinityPriority prioritizes nodes according to node affinity scheduling preferences diff --git a/plugin/pkg/scheduler/algorithm/priorities/selector_spreading.go b/plugin/pkg/scheduler/algorithm/priorities/selector_spreading.go index a706a97eb48..8e5eb308ba6 100644 --- a/plugin/pkg/scheduler/algorithm/priorities/selector_spreading.go +++ b/plugin/pkg/scheduler/algorithm/priorities/selector_spreading.go @@ -19,7 +19,6 @@ package priorities import ( "sync" - "github.com/golang/glog" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" @@ -28,6 +27,8 @@ import ( "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm" schedulerapi "k8s.io/kubernetes/plugin/pkg/scheduler/api" "k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache" + + "github.com/golang/glog" ) // When zone information is present, give 2/3 of the weighting to zone spreading, 1/3 to node spreading diff --git a/plugin/pkg/scheduler/algorithm/priorities/taint_toleration.go b/plugin/pkg/scheduler/algorithm/priorities/taint_toleration.go index 5817e4c89ce..a017531f2f2 100644 --- a/plugin/pkg/scheduler/algorithm/priorities/taint_toleration.go +++ b/plugin/pkg/scheduler/algorithm/priorities/taint_toleration.go @@ -19,11 +19,12 @@ package priorities import ( "fmt" - "github.com/golang/glog" "k8s.io/api/core/v1" v1helper "k8s.io/kubernetes/pkg/api/v1/helper" schedulerapi "k8s.io/kubernetes/plugin/pkg/scheduler/api" "k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache" + + "github.com/golang/glog" ) // CountIntolerableTaintsPreferNoSchedule gives the count of intolerable taints of a pod with effect PreferNoSchedule diff --git a/plugin/pkg/scheduler/algorithmprovider/defaults/compatibility_test.go b/plugin/pkg/scheduler/algorithmprovider/defaults/compatibility_test.go index 42ccee1ab0c..1aa45ef8bdb 100644 --- a/plugin/pkg/scheduler/algorithmprovider/defaults/compatibility_test.go +++ b/plugin/pkg/scheduler/algorithmprovider/defaults/compatibility_test.go @@ -18,11 +18,10 @@ package defaults import ( "fmt" + "net/http/httptest" "reflect" "testing" - "net/http/httptest" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" diff --git a/plugin/pkg/scheduler/core/generic_scheduler.go b/plugin/pkg/scheduler/core/generic_scheduler.go index 984c783b909..a9244f6636e 100644 --- a/plugin/pkg/scheduler/core/generic_scheduler.go +++ b/plugin/pkg/scheduler/core/generic_scheduler.go @@ -24,7 +24,6 @@ import ( "sync/atomic" "time" - "github.com/golang/glog" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/errors" utiltrace "k8s.io/apiserver/pkg/util/trace" @@ -33,6 +32,8 @@ import ( "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/predicates" schedulerapi "k8s.io/kubernetes/plugin/pkg/scheduler/api" "k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache" + + "github.com/golang/glog" ) type FailedPredicateMap map[string][]algorithm.PredicateFailureReason diff --git a/plugin/pkg/scheduler/factory/factory.go b/plugin/pkg/scheduler/factory/factory.go index ae9cd535bd3..10675413640 100644 --- a/plugin/pkg/scheduler/factory/factory.go +++ b/plugin/pkg/scheduler/factory/factory.go @@ -23,7 +23,6 @@ import ( "reflect" "time" - "github.com/golang/glog" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -52,6 +51,8 @@ import ( "k8s.io/kubernetes/plugin/pkg/scheduler/core" "k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache" "k8s.io/kubernetes/plugin/pkg/scheduler/util" + + "github.com/golang/glog" ) const ( diff --git a/plugin/pkg/scheduler/factory/plugins.go b/plugin/pkg/scheduler/factory/plugins.go index bb4db346106..14776a7dbe1 100644 --- a/plugin/pkg/scheduler/factory/plugins.go +++ b/plugin/pkg/scheduler/factory/plugins.go @@ -23,12 +23,13 @@ import ( "strings" "sync" - "github.com/golang/glog" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm" "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/predicates" "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/priorities" schedulerapi "k8s.io/kubernetes/plugin/pkg/scheduler/api" + + "github.com/golang/glog" ) // PluginFactoryArgs are passed to all plugin factory functions. diff --git a/plugin/pkg/scheduler/factory/plugins_test.go b/plugin/pkg/scheduler/factory/plugins_test.go index d14324bcfd4..0f78fd1789d 100644 --- a/plugin/pkg/scheduler/factory/plugins_test.go +++ b/plugin/pkg/scheduler/factory/plugins_test.go @@ -17,9 +17,10 @@ limitations under the License. package factory import ( + "testing" + "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm" "k8s.io/kubernetes/plugin/pkg/scheduler/api" - "testing" ) func TestAlgorithmNameValidation(t *testing.T) { diff --git a/plugin/pkg/scheduler/schedulercache/cache.go b/plugin/pkg/scheduler/schedulercache/cache.go index 40c85eb99ab..be436f7b7e2 100644 --- a/plugin/pkg/scheduler/schedulercache/cache.go +++ b/plugin/pkg/scheduler/schedulercache/cache.go @@ -21,10 +21,11 @@ import ( "sync" "time" - "github.com/golang/glog" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/wait" + + "github.com/golang/glog" ) var ( diff --git a/plugin/pkg/scheduler/util/backoff_utils.go b/plugin/pkg/scheduler/util/backoff_utils.go index 9226f4cca5b..aa8a8e61fd8 100644 --- a/plugin/pkg/scheduler/util/backoff_utils.go +++ b/plugin/pkg/scheduler/util/backoff_utils.go @@ -22,8 +22,9 @@ import ( "sync/atomic" "time" - "github.com/golang/glog" ktypes "k8s.io/apimachinery/pkg/types" + + "github.com/golang/glog" ) type clock interface { diff --git a/plugin/pkg/scheduler/util/backoff_utils_test.go b/plugin/pkg/scheduler/util/backoff_utils_test.go index 11c6fd56f04..8f61b637e7d 100644 --- a/plugin/pkg/scheduler/util/backoff_utils_test.go +++ b/plugin/pkg/scheduler/util/backoff_utils_test.go @@ -17,9 +17,10 @@ limitations under the License. package util import ( - ktypes "k8s.io/apimachinery/pkg/types" "testing" "time" + + ktypes "k8s.io/apimachinery/pkg/types" ) type fakeClock struct {