mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Update scheduler perf to spin up similar client to other tests
This commit is contained in:
parent
a0d4878ea9
commit
856899b38c
@ -18,7 +18,7 @@ set -o errexit
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../../../..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../../../
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
@ -35,15 +35,18 @@ cleanup() {
|
|||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
kube::etcd::start
|
kube::etcd::start
|
||||||
kube::log::status "performance test start"
|
|
||||||
|
|
||||||
# We are using the benchmark suite to do profiling. Because it only runs a few pods and
|
# We are using the benchmark suite to do profiling. Because it only runs a few pods and
|
||||||
# theoretically it has less variance.
|
# theoretically it has less variance.
|
||||||
if ${RUN_BENCHMARK:-false}; then
|
if ${RUN_BENCHMARK:-false}; then
|
||||||
|
kube::log::status "performance test (benchmark) compiling"
|
||||||
go test -c -o "perf.test"
|
go test -c -o "perf.test"
|
||||||
|
|
||||||
|
kube::log::status "performance test (benchmark) start"
|
||||||
"./perf.test" -test.bench=. -test.run=xxxx -test.cpuprofile=prof.out -test.short=false
|
"./perf.test" -test.bench=. -test.run=xxxx -test.cpuprofile=prof.out -test.short=false
|
||||||
kube::log::status "benchmark tests finished"
|
kube::log::status "...benchmark tests finished"
|
||||||
fi
|
fi
|
||||||
# Running density tests. It might take a long time.
|
# Running density tests. It might take a long time.
|
||||||
|
kube::log::status "performance test (density) start"
|
||||||
go test -test.run=. -test.timeout=60m -test.short=false
|
go test -test.run=. -test.timeout=60m -test.short=false
|
||||||
kube::log::status "density tests finished"
|
kube::log::status "...density tests finished"
|
||||||
|
@ -27,7 +27,6 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/client/record"
|
"k8s.io/kubernetes/pkg/client/record"
|
||||||
"k8s.io/kubernetes/pkg/client/restclient"
|
"k8s.io/kubernetes/pkg/client/restclient"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/master"
|
|
||||||
"k8s.io/kubernetes/pkg/util/workqueue"
|
"k8s.io/kubernetes/pkg/util/workqueue"
|
||||||
"k8s.io/kubernetes/plugin/pkg/scheduler"
|
"k8s.io/kubernetes/plugin/pkg/scheduler"
|
||||||
_ "k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider"
|
_ "k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider"
|
||||||
@ -44,16 +43,15 @@ import (
|
|||||||
// Notes on rate limiter:
|
// Notes on rate limiter:
|
||||||
// - client rate limit is set to 5000.
|
// - client rate limit is set to 5000.
|
||||||
func mustSetupScheduler() (schedulerConfigFactory *factory.ConfigFactory, destroyFunc func()) {
|
func mustSetupScheduler() (schedulerConfigFactory *factory.ConfigFactory, destroyFunc func()) {
|
||||||
var m *master.Master
|
|
||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
h := &framework.MasterHolder{Initialized: make(chan struct{})}
|
||||||
m, err := masterConfig.Complete().New()
|
|
||||||
if err != nil {
|
|
||||||
panic("error in brining up the master: " + err.Error())
|
|
||||||
}
|
|
||||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||||
m.GenericAPIServer.Handler.ServeHTTP(w, req)
|
<-h.Initialized
|
||||||
|
h.M.GenericAPIServer.Handler.ServeHTTP(w, req)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
framework.RunAMasterUsingServer(framework.NewIntegrationTestMasterConfig(), s, h)
|
||||||
|
|
||||||
c := client.NewOrDie(&restclient.Config{
|
c := client.NewOrDie(&restclient.Config{
|
||||||
Host: s.URL,
|
Host: s.URL,
|
||||||
ContentConfig: restclient.ContentConfig{GroupVersion: ®istered.GroupOrDie(api.GroupName).GroupVersion},
|
ContentConfig: restclient.ContentConfig{GroupVersion: ®istered.GroupOrDie(api.GroupName).GroupVersion},
|
||||||
@ -62,6 +60,7 @@ func mustSetupScheduler() (schedulerConfigFactory *factory.ConfigFactory, destro
|
|||||||
})
|
})
|
||||||
|
|
||||||
schedulerConfigFactory = factory.NewConfigFactory(c, api.DefaultSchedulerName, api.DefaultHardPodAffinitySymmetricWeight, api.DefaultFailureDomains)
|
schedulerConfigFactory = factory.NewConfigFactory(c, api.DefaultSchedulerName, api.DefaultHardPodAffinitySymmetricWeight, api.DefaultFailureDomains)
|
||||||
|
|
||||||
schedulerConfig, err := schedulerConfigFactory.Create()
|
schedulerConfig, err := schedulerConfigFactory.Create()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("Couldn't create scheduler config")
|
panic("Couldn't create scheduler config")
|
||||||
|
Loading…
Reference in New Issue
Block a user