diff --git a/cluster/log-dump/log-dump.sh b/cluster/log-dump/log-dump.sh index 9e29a8989ea..13c12e1a957 100755 --- a/cluster/log-dump/log-dump.sh +++ b/cluster/log-dump/log-dump.sh @@ -50,7 +50,7 @@ readonly gce_logfiles="startupscript" readonly kern_logfile="kern" readonly initd_logfiles="docker" readonly supervisord_logfiles="kubelet supervisor/supervisord supervisor/kubelet-stdout supervisor/kubelet-stderr supervisor/docker-stdout supervisor/docker-stderr" -readonly systemd_services="kubelet docker" +readonly systemd_services="kubelet ${SYSTEMD_SERVICES:-docker}" # Limit the number of concurrent node connections so that we don't run out of # file descriptors for large clusters. diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index 528bb54952d..dcc07026a1a 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -65,6 +65,9 @@ type TestContextType struct { GCEUpgradeScript string ContainerRuntime string ContainerRuntimeEndpoint string + // SystemdServices are comma separated list of systemd services the test framework + // will dump logs for. + SystemdServices string ImageServiceEndpoint string MasterOSDistro string NodeOSDistro string @@ -199,6 +202,7 @@ func RegisterCommonFlags() { flag.StringVar(&TestContext.Viper, "viper-config", "e2e", "The name of the viper config i.e. 'e2e' will read values from 'e2e.json' locally. All e2e parameters are meant to be configurable by viper.") flag.StringVar(&TestContext.ContainerRuntime, "container-runtime", "docker", "The container runtime of cluster VM instances (docker/rkt/remote).") flag.StringVar(&TestContext.ContainerRuntimeEndpoint, "container-runtime-endpoint", "", "The container runtime endpoint of cluster VM instances.") + flag.StringVar(&TestContext.SystemdServices, "systemd-services", "docker", "The comma separated list of systemd services the framework will dump logs for.") flag.StringVar(&TestContext.ImageServiceEndpoint, "image-service-endpoint", "", "The image service endpoint of cluster VM instances.") flag.StringVar(&TestContext.DockershimCheckpointDir, "dockershim-checkpoint-dir", "/var/lib/dockershim/sandbox", "The directory for dockershim to store sandbox checkpoints.") flag.StringVar(&TestContext.KubernetesAnywherePath, "kubernetes-anywhere-path", "/workspace/kubernetes-anywhere", "Which directory kubernetes-anywhere is installed to.") diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index 42a62703813..c5d1a78a7ea 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -4517,6 +4517,7 @@ func CoreDump(dir string) { Logf("Dumping logs locally to: %s", dir) cmd = exec.Command(path.Join(TestContext.RepoRoot, "cluster", "log-dump", "log-dump.sh"), dir) } + cmd.Env = append(os.Environ(), fmt.Sprintf("SYSTEMD_SERVICES=%s", parseSystemdServices(TestContext.SystemdServices))) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if err := cmd.Run(); err != nil { @@ -4524,6 +4525,11 @@ func CoreDump(dir string) { } } +// parseSystemdServices converts services separator from comma to space. +func parseSystemdServices(services string) string { + return strings.TrimSpace(strings.Replace(services, ",", " ", -1)) +} + func UpdatePodWithRetries(client clientset.Interface, ns, name string, update func(*v1.Pod)) (*v1.Pod, error) { for i := 0; i < 3; i++ { pod, err := client.CoreV1().Pods(ns).Get(name, metav1.GetOptions{})