From 7abfa2dafb467faa595731847a5a76ce958eda59 Mon Sep 17 00:00:00 2001 From: Anish Shah Date: Thu, 3 Oct 2024 09:13:35 +0000 Subject: [PATCH 1/4] possible deflake --- test/e2e_node/eviction_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/e2e_node/eviction_test.go b/test/e2e_node/eviction_test.go index 36c5095f9c6..f83aa064b43 100644 --- a/test/e2e_node/eviction_test.go +++ b/test/e2e_node/eviction_test.go @@ -199,7 +199,7 @@ var _ = SIGDescribe("LocalStorageEviction", framework.WithSlow(), framework.With runEvictionTest(f, pressureTimeout, expectedNodeCondition, expectedStarvedResource, logDiskMetrics, []podEvictSpec{ { evictionPriority: 1, - pod: diskConsumingPod("container-disk-hog", lotsOfDisk, nil, v1.ResourceRequirements{}), + pod: diskConsumingPod("container-disk-hog", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { evictionPriority: 0, @@ -238,7 +238,7 @@ var _ = SIGDescribe("LocalStorageSoftEviction", framework.WithSlow(), framework. runEvictionTest(f, pressureTimeout, expectedNodeCondition, expectedStarvedResource, logDiskMetrics, []podEvictSpec{ { evictionPriority: 1, - pod: diskConsumingPod("container-disk-hog", lotsOfDisk, nil, v1.ResourceRequirements{}), + pod: diskConsumingPod("container-disk-hog", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { evictionPriority: 0, @@ -479,16 +479,16 @@ var _ = SIGDescribe("PriorityLocalStorageEvictionOrdering", framework.WithSlow() specs := []podEvictSpec{ { evictionPriority: 2, - pod: diskConsumingPod("best-effort-disk", lotsOfDisk, nil, v1.ResourceRequirements{}), + pod: diskConsumingPod("best-effort-disk", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { evictionPriority: 1, - pod: diskConsumingPod("high-priority-disk", lotsOfDisk, nil, v1.ResourceRequirements{}), + pod: diskConsumingPod("high-priority-disk", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { evictionPriority: 0, // Only require 99% accuracy (297/300 Mb) because on some OS distributions, the file itself (excluding contents), consumes disk space. - pod: diskConsumingPod("guaranteed-disk", 297 /* Mb */, nil, v1.ResourceRequirements{ + pod: diskConsumingPod("guaranteed-disk", 297 /* Mb */, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{ Requests: v1.ResourceList{ v1.ResourceEphemeralStorage: resource.MustParse("300Mi"), }, From 9af732a34968ddf55f42956f66404021de875587 Mon Sep 17 00:00:00 2001 From: Anish Shah Date: Fri, 4 Oct 2024 18:38:40 +0000 Subject: [PATCH 2/4] added a comment to explain the usage of emptyDir volume in eviction test #127864 --- test/e2e_node/eviction_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/e2e_node/eviction_test.go b/test/e2e_node/eviction_test.go index f83aa064b43..eff1fcac722 100644 --- a/test/e2e_node/eviction_test.go +++ b/test/e2e_node/eviction_test.go @@ -199,6 +199,8 @@ var _ = SIGDescribe("LocalStorageEviction", framework.WithSlow(), framework.With runEvictionTest(f, pressureTimeout, expectedNodeCondition, expectedStarvedResource, logDiskMetrics, []podEvictSpec{ { evictionPriority: 1, + // TODO(#127864): Due to a race condition between eviction manager and containerd GC, + // we provision an emptyDir volume instead of writing to the writable container layers. pod: diskConsumingPod("container-disk-hog", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { @@ -238,6 +240,8 @@ var _ = SIGDescribe("LocalStorageSoftEviction", framework.WithSlow(), framework. runEvictionTest(f, pressureTimeout, expectedNodeCondition, expectedStarvedResource, logDiskMetrics, []podEvictSpec{ { evictionPriority: 1, + // TODO(#127864): Due to a race condition between eviction manager and containerd GC, + // we provision an emptyDir volume instead of writing to the writable container layers. pod: diskConsumingPod("container-disk-hog", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { @@ -479,10 +483,14 @@ var _ = SIGDescribe("PriorityLocalStorageEvictionOrdering", framework.WithSlow() specs := []podEvictSpec{ { evictionPriority: 2, + // TODO(#127864): Due to a race condition between eviction manager and containerd GC, + // we provision an emptyDir volume instead of writing to the writable container layers. pod: diskConsumingPod("best-effort-disk", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { evictionPriority: 1, + // TODO(#127864): Due to a race condition between eviction manager and containerd GC, + // we provision an emptyDir volume instead of writing to the writable container layers. pod: diskConsumingPod("high-priority-disk", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { From a37101a202e70227e017dc371f260c0af51f846b Mon Sep 17 00:00:00 2001 From: Anish Shah Date: Fri, 4 Oct 2024 19:47:21 +0000 Subject: [PATCH 3/4] gofmt fix --- test/e2e_node/eviction_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/e2e_node/eviction_test.go b/test/e2e_node/eviction_test.go index eff1fcac722..94ea4129576 100644 --- a/test/e2e_node/eviction_test.go +++ b/test/e2e_node/eviction_test.go @@ -201,7 +201,7 @@ var _ = SIGDescribe("LocalStorageEviction", framework.WithSlow(), framework.With evictionPriority: 1, // TODO(#127864): Due to a race condition between eviction manager and containerd GC, // we provision an emptyDir volume instead of writing to the writable container layers. - pod: diskConsumingPod("container-disk-hog", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), + pod: diskConsumingPod("container-disk-hog", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { evictionPriority: 0, @@ -242,7 +242,7 @@ var _ = SIGDescribe("LocalStorageSoftEviction", framework.WithSlow(), framework. evictionPriority: 1, // TODO(#127864): Due to a race condition between eviction manager and containerd GC, // we provision an emptyDir volume instead of writing to the writable container layers. - pod: diskConsumingPod("container-disk-hog", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), + pod: diskConsumingPod("container-disk-hog", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { evictionPriority: 0, @@ -485,13 +485,13 @@ var _ = SIGDescribe("PriorityLocalStorageEvictionOrdering", framework.WithSlow() evictionPriority: 2, // TODO(#127864): Due to a race condition between eviction manager and containerd GC, // we provision an emptyDir volume instead of writing to the writable container layers. - pod: diskConsumingPod("best-effort-disk", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), + pod: diskConsumingPod("best-effort-disk", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { evictionPriority: 1, // TODO(#127864): Due to a race condition between eviction manager and containerd GC, // we provision an emptyDir volume instead of writing to the writable container layers. - pod: diskConsumingPod("high-priority-disk", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), + pod: diskConsumingPod("high-priority-disk", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { evictionPriority: 0, From 91b70a9f1960ad3e070e1f15495c28ff49297cfb Mon Sep 17 00:00:00 2001 From: Anish Shah Date: Fri, 4 Oct 2024 22:49:14 +0000 Subject: [PATCH 4/4] fix InodeEvictionTest --- test/e2e_node/eviction_test.go | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/test/e2e_node/eviction_test.go b/test/e2e_node/eviction_test.go index 94ea4129576..484130ce6c8 100644 --- a/test/e2e_node/eviction_test.go +++ b/test/e2e_node/eviction_test.go @@ -92,11 +92,9 @@ var _ = SIGDescribe("InodeEviction", framework.WithSlow(), framework.WithSerial( runEvictionTest(f, pressureTimeout, expectedNodeCondition, expectedStarvedResource, logInodeMetrics, []podEvictSpec{ { evictionPriority: 1, - pod: inodeConsumingPod("container-inode-hog", lotsOfFiles, nil), - }, - { - evictionPriority: 1, - pod: inodeConsumingPod("volume-inode-hog", lotsOfFiles, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}), + // TODO(#127864): Container runtime may not immediate free up the resources after the pod eviction, + // causing the test to fail. We provision an emptyDir volume to avoid relying on the runtime behavior. + pod: inodeConsumingPod("volume-inode-hog", lotsOfFiles, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}), }, { evictionPriority: 0, @@ -199,8 +197,8 @@ var _ = SIGDescribe("LocalStorageEviction", framework.WithSlow(), framework.With runEvictionTest(f, pressureTimeout, expectedNodeCondition, expectedStarvedResource, logDiskMetrics, []podEvictSpec{ { evictionPriority: 1, - // TODO(#127864): Due to a race condition between eviction manager and containerd GC, - // we provision an emptyDir volume instead of writing to the writable container layers. + // TODO(#127864): Container runtime may not immediate free up the resources after the pod eviction, + // causing the test to fail. We provision an emptyDir volume to avoid relying on the runtime behavior. pod: diskConsumingPod("container-disk-hog", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { @@ -240,8 +238,8 @@ var _ = SIGDescribe("LocalStorageSoftEviction", framework.WithSlow(), framework. runEvictionTest(f, pressureTimeout, expectedNodeCondition, expectedStarvedResource, logDiskMetrics, []podEvictSpec{ { evictionPriority: 1, - // TODO(#127864): Due to a race condition between eviction manager and containerd GC, - // we provision an emptyDir volume instead of writing to the writable container layers. + // TODO(#127864): Container runtime may not immediate free up the resources after the pod eviction, + // causing the test to fail. We provision an emptyDir volume to avoid relying on the runtime behavior. pod: diskConsumingPod("container-disk-hog", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { @@ -483,14 +481,14 @@ var _ = SIGDescribe("PriorityLocalStorageEvictionOrdering", framework.WithSlow() specs := []podEvictSpec{ { evictionPriority: 2, - // TODO(#127864): Due to a race condition between eviction manager and containerd GC, - // we provision an emptyDir volume instead of writing to the writable container layers. + // TODO(#127864): Container runtime may not immediate free up the resources after the pod eviction, + // causing the test to fail. We provision an emptyDir volume to avoid relying on the runtime behavior. pod: diskConsumingPod("best-effort-disk", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, { evictionPriority: 1, - // TODO(#127864): Due to a race condition between eviction manager and containerd GC, - // we provision an emptyDir volume instead of writing to the writable container layers. + // TODO(#127864): Container runtime may not immediate free up the resources after the pod eviction, + // causing the test to fail. We provision an emptyDir volume to avoid relying on the runtime behavior. pod: diskConsumingPod("high-priority-disk", lotsOfDisk, &v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}}, v1.ResourceRequirements{}), }, {