diff --git a/hack/lib/etcd.sh b/hack/lib/etcd.sh index 756e342499c..4df9c3fc442 100755 --- a/hack/lib/etcd.sh +++ b/hack/lib/etcd.sh @@ -19,6 +19,10 @@ ETCD_VERSION=${ETCD_VERSION:-3.5.1} ETCD_HOST=${ETCD_HOST:-127.0.0.1} ETCD_PORT=${ETCD_PORT:-2379} +# This is intentionally not called ETCD_LOG_LEVEL: +# etcd checks that and compains when it is set in addition +# to the command line argument, even when both have the same value. +ETCD_LOGLEVEL=${ETCD_LOGLEVEL:-debug} export KUBE_INTEGRATION_ETCD_URL="http://${ETCD_HOST}:${ETCD_PORT}" kube::etcd::validate() { @@ -82,8 +86,8 @@ kube::etcd::start() { else ETCD_LOGFILE=${ETCD_LOGFILE:-"/dev/null"} fi - kube::log::info "etcd --advertise-client-urls ${KUBE_INTEGRATION_ETCD_URL} --data-dir ${ETCD_DIR} --listen-client-urls http://${ETCD_HOST}:${ETCD_PORT} --log-level=debug > \"${ETCD_LOGFILE}\" 2>/dev/null" - etcd --advertise-client-urls "${KUBE_INTEGRATION_ETCD_URL}" --data-dir "${ETCD_DIR}" --listen-client-urls "${KUBE_INTEGRATION_ETCD_URL}" --log-level=debug 2> "${ETCD_LOGFILE}" >/dev/null & + kube::log::info "etcd --advertise-client-urls ${KUBE_INTEGRATION_ETCD_URL} --data-dir ${ETCD_DIR} --listen-client-urls http://${ETCD_HOST}:${ETCD_PORT} --log-level=${ETCD_LOGLEVEL} 2> \"${ETCD_LOGFILE}\" >/dev/null" + etcd --advertise-client-urls "${KUBE_INTEGRATION_ETCD_URL}" --data-dir "${ETCD_DIR}" --listen-client-urls "${KUBE_INTEGRATION_ETCD_URL}" --log-level="${ETCD_LOGLEVEL}" 2> "${ETCD_LOGFILE}" >/dev/null & ETCD_PID=$! echo "Waiting for etcd to come up." diff --git a/pkg/scheduler/framework/plugins/interpodaffinity/plugin.go b/pkg/scheduler/framework/plugins/interpodaffinity/plugin.go index da6b35b5e68..d9d3e5a94da 100644 --- a/pkg/scheduler/framework/plugins/interpodaffinity/plugin.go +++ b/pkg/scheduler/framework/plugins/interpodaffinity/plugin.go @@ -135,6 +135,6 @@ func GetNamespaceLabelsSnapshot(ns string, nsLister listersv1.NamespaceLister) ( // Create and return snapshot of the labels. return labels.Merge(podNS.Labels, nil) } - klog.ErrorS(err, "getting namespace, assuming empty set of namespace labels", "namespace", ns) + klog.V(3).InfoS("getting namespace, assuming empty set of namespace labels", "namespace", ns, "err", err) return } diff --git a/test/integration/framework/controlplane_utils.go b/test/integration/framework/controlplane_utils.go index 9513a9fa4e1..d0dfcdea032 100644 --- a/test/integration/framework/controlplane_utils.go +++ b/test/integration/framework/controlplane_utils.go @@ -65,6 +65,13 @@ const ( UnprivilegedUserToken = "unprivileged-user" ) +// MinVerbosity determines the minimum klog verbosity when running tests that +// involve the apiserver. This overrides the -v value from the command line, +// i.e. -v=0 has no effect when MinVerbosity is 4 (the default). Tests can opt +// out of this by setting MinVerbosity to zero before starting the control +// plane or choose some different minimum verbosity. +var MinVerbosity = 4 + // Config is a struct of configuration directives for NewControlPlaneComponents. type Config struct { // If nil, a default is used, partially filled configs will not get populated. @@ -139,11 +146,11 @@ func startAPIServerOrDie(controlPlaneConfig *controlplane.Config, incomingServer var m *controlplane.Instance var s *httptest.Server - // Ensure we log at least level 4 + // Ensure we log at least at the desired level v := flag.Lookup("v").Value level, _ := strconv.Atoi(v.String()) - if level < 4 { - v.Set("4") + if level < MinVerbosity { + v.Set(strconv.Itoa(MinVerbosity)) } if incomingServer != nil { diff --git a/test/integration/scheduler_perf/README.md b/test/integration/scheduler_perf/README.md index 536ce951354..5a6ea8d10ef 100644 --- a/test/integration/scheduler_perf/README.md +++ b/test/integration/scheduler_perf/README.md @@ -36,14 +36,14 @@ How To Run ```shell # In Kubernetes root path -make test-integration WHAT=./test/integration/scheduler_perf KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=true -logtostderr=true -run=." KUBE_TIMEOUT="--timeout=60m" SHORT="--short=false" +make test-integration WHAT=./test/integration/scheduler_perf ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=true -logtostderr=true -run=." KUBE_TIMEOUT="--timeout=60m" SHORT="--short=false" ``` ## Benchmark tests ```shell # In Kubernetes root path -make test-integration WHAT=./test/integration/scheduler_perf KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling" +make test-integration WHAT=./test/integration/scheduler_perf ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling" ``` The benchmark suite runs all the tests specified under config/performance-config.yaml. @@ -58,14 +58,14 @@ Otherwise, the golang benchmark framework will try to run a test more than once ```shell # In Kubernetes root path -make test-integration WHAT=./test/integration/scheduler_perf KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling/SchedulingBasic/5000Nodes/5000InitPods/1000PodsToSchedule" +make test-integration WHAT=./test/integration/scheduler_perf ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling/SchedulingBasic/5000Nodes/5000InitPods/1000PodsToSchedule" ``` To produce a cpu profile: ```shell # In Kubernetes root path -make test-integration WHAT=./test/integration/scheduler_perf KUBE_TIMEOUT="-timeout=3600s" KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling -cpuprofile ~/cpu-profile.out" +make test-integration WHAT=./test/integration/scheduler_perf KUBE_TIMEOUT="-timeout=3600s" ETCD_LOGLEVEL=warn KUBE_TEST_VMODULE="''" KUBE_TEST_ARGS="-alsologtostderr=false -logtostderr=false -run=^$$ -benchtime=1ns -bench=BenchmarkPerfScheduling -cpuprofile ~/cpu-profile.out" ``` ### How to configure benchmark tests diff --git a/test/integration/scheduler_perf/config/performance-config.yaml b/test/integration/scheduler_perf/config/performance-config.yaml index 20d79dcaeb4..ff75a1b3107 100644 --- a/test/integration/scheduler_perf/config/performance-config.yaml +++ b/test/integration/scheduler_perf/config/performance-config.yaml @@ -373,7 +373,7 @@ initPods: 2000 measurePods: 1000 -- name: Preemption +- name: PreemptionBasic workloadTemplate: - opcode: createNodes countParam: $initNodes diff --git a/test/integration/scheduler_perf/scheduler_perf_test.go b/test/integration/scheduler_perf/scheduler_perf_test.go index fbb7fb0134f..8cfa75f7b45 100644 --- a/test/integration/scheduler_perf/scheduler_perf_test.go +++ b/test/integration/scheduler_perf/scheduler_perf_test.go @@ -537,7 +537,7 @@ func BenchmarkPerfScheduling(b *testing.B) { }) } if err := dataItems2JSONFile(dataItems, b.Name()); err != nil { - klog.Fatalf("%v: unable to write measured data: %v", b.Name(), err) + klog.Fatalf("%v: unable to write measured data %+v: %v", b.Name(), dataItems, err) } } diff --git a/test/integration/scheduler_perf/util.go b/test/integration/scheduler_perf/util.go index 5d9b809707a..6e84213788f 100644 --- a/test/integration/scheduler_perf/util.go +++ b/test/integration/scheduler_perf/util.go @@ -43,6 +43,7 @@ import ( "k8s.io/kube-scheduler/config/v1beta2" "k8s.io/kubernetes/pkg/scheduler/apis/config" kubeschedulerscheme "k8s.io/kubernetes/pkg/scheduler/apis/config/scheme" + "k8s.io/kubernetes/test/integration/framework" "k8s.io/kubernetes/test/integration/util" testutils "k8s.io/kubernetes/test/utils" ) @@ -74,6 +75,8 @@ func newDefaultComponentConfig() (*config.KubeSchedulerConfiguration, error) { // Notes on rate limiter: // - client rate limit is set to 5000. func mustSetupScheduler(config *config.KubeSchedulerConfiguration) (util.ShutdownFunc, coreinformers.PodInformer, clientset.Interface, dynamic.Interface) { + // Run API server with minimimal logging by default. Can be raised with -v. + framework.MinVerbosity = 0 apiURL, apiShutdown := util.StartApiserver() var err error