diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index c99c80c246d..a6b4c5d302a 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -169,6 +169,6 @@ func RegisterNodeFlags() { flag.BoolVar(&TestContext.DisableKubenet, "disable-kubenet", false, "If true, start kubelet without kubenet. (default false)") // TODO: uncomment this when the flag is re-enabled in kubelet //flag.BoolVar(&TestContext.CgroupsPerQOS, "cgroups-per-qos", false, "Enable creation of QoS cgroup hierarchy, if true top level QoS and pod cgroups are created.") - flag.StringVar(&TestContext.EvictionHard, "eviction-hard", "memory.available<250Mi,imagefs.available<10%%", "The hard eviction thresholds. If set, pods get evicted when the specified resources drop below the thresholds.") + flag.StringVar(&TestContext.EvictionHard, "eviction-hard", "memory.available<250Mi,imagefs.available<10%", "The hard eviction thresholds. If set, pods get evicted when the specified resources drop below the thresholds.") flag.StringVar(&TestContext.ManifestPath, "manifest-path", "", "The path to the static pod manifest file.") } diff --git a/test/e2e_node/disk_eviction_test.go b/test/e2e_node/disk_eviction_test.go index 4de87537449..2415dd158e8 100644 --- a/test/e2e_node/disk_eviction_test.go +++ b/test/e2e_node/disk_eviction_test.go @@ -67,7 +67,7 @@ var _ = framework.KubeDescribe("Kubelet Eviction Manager [Serial] [Disruptive]", }) BeforeEach(func() { - if !evictionOptionIsSet() { + if !isImageSupported() || !evictionOptionIsSet() { return } @@ -97,6 +97,10 @@ var _ = framework.KubeDescribe("Kubelet Eviction Manager [Serial] [Disruptive]", }) It("should evict the pod using the most disk space [Slow]", func() { + if !isImageSupported() { + framework.Logf("test skipped because the image is not supported by the test") + return + } if !evictionOptionIsSet() { framework.Logf("test skipped because eviction option is not set") return @@ -217,3 +221,9 @@ func recordContainerId(containersToCleanUp map[string]bool, containerStatuses [] func evictionOptionIsSet() bool { return len(framework.TestContext.EvictionHard) > 0 } + +func isImageSupported() bool { + // TODO: Only images with image fs is selected for testing for now. When the kubelet settings can be dynamically updated, + // instead of skipping images the eviction thresholds should be adjusted based on the images. + return strings.Contains(framework.TestContext.NodeName, "-gci-dev-") +} diff --git a/test/e2e_node/e2e_service.go b/test/e2e_node/e2e_service.go index 9a68f416ccc..c41c9705fb8 100644 --- a/test/e2e_node/e2e_service.go +++ b/test/e2e_node/e2e_service.go @@ -347,6 +347,7 @@ func (es *e2eService) startKubeletServer() (*server, error) { es.logFiles["kubelet.log"] = logFileData{ journalctlCommand: []string{"-u", unitName}, } + framework.TestContext.EvictionHard = adjustConfigForSystemd(framework.TestContext.EvictionHard) } else { cmdArgs = append(cmdArgs, getKubeletServerBin()) cmdArgs = append(cmdArgs, @@ -705,3 +706,7 @@ func (s *server) kill() error { return fmt.Errorf("unable to stop %q", name) } + +func adjustConfigForSystemd(config string) string { + return strings.Replace(config, "%", "%%", -1) +}