diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index 7d0543c4b4c..fd2e7f8a41a 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -325,10 +325,11 @@ func (f *Framework) AfterEach() { f.TestSummaries = append(f.TestSummaries, f.logsSizeVerifier.GetSummary()) } - if TestContext.GatherMetricsAfterTest { + if TestContext.GatherMetricsAfterTest != "false" { By("Gathering metrics") - // Grab apiserver, scheduler, controller-manager metrics and nodes' kubelet metrics (for non-kubemark case). - grabber, err := metrics.NewMetricsGrabber(f.ClientSet, !ProviderIs("kubemark"), true, true, true) + // Grab apiserver, scheduler, controller-manager metrics and (optionally) nodes' kubelet metrics. + grabMetricsFromKubelets := TestContext.GatherMetricsAfterTest != "master" && !ProviderIs("kubemark") + grabber, err := metrics.NewMetricsGrabber(f.ClientSet, grabMetricsFromKubelets, true, true, true) if err != nil { Logf("Failed to create MetricsGrabber (skipping metrics gathering): %v", err) } else { diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index 6099e75cdc3..0883eb128ae 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -73,7 +73,7 @@ type TestContextType struct { // only master Node will be monitored. GatherKubeSystemResourceUsageData string GatherLogsSizes bool - GatherMetricsAfterTest bool + GatherMetricsAfterTest string GatherSuiteMetricsAfterTest bool // Currently supported values are 'hr' for human-readable and 'json'. It's a comma separated list. OutputPrintType string @@ -176,7 +176,7 @@ func RegisterCommonFlags() { flag.StringVar(&TestContext.GatherKubeSystemResourceUsageData, "gather-resource-usage", "false", "If set to 'true' or 'all' framework will be monitoring resource usage of system all add-ons in (some) e2e tests, if set to 'master' framework will be monitoring master node only, if set to 'none' of 'false' monitoring will be turned off.") flag.BoolVar(&TestContext.GatherLogsSizes, "gather-logs-sizes", false, "If set to true framework will be monitoring logs sizes on all machines running e2e tests.") - flag.BoolVar(&TestContext.GatherMetricsAfterTest, "gather-metrics-at-teardown", false, "If set to true framwork will gather metrics from all components after each test.") + flag.StringVar(&TestContext.GatherMetricsAfterTest, "gather-metrics-at-teardown", "false", "If set to 'true' framework will gather metrics from all components after each test. If set to 'master' only master component metrics would be gathered.") flag.BoolVar(&TestContext.GatherSuiteMetricsAfterTest, "gather-suite-metrics-at-teardown", false, "If set to true framwork will gather metrics from all components after the whole test suite completes.") flag.StringVar(&TestContext.OutputPrintType, "output-print-type", "json", "Format in which summaries should be printed: 'hr' for human readable, 'json' for JSON ones.") flag.BoolVar(&TestContext.DumpLogsOnFailure, "dump-logs-on-failure", true, "If set to true test will dump data about the namespace in which test was running.")