Fix for OOMKiller test consistently failing in EC2 cgroupv1 serial jobs

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
Davanum Srinivas 2024-07-12 20:23:20 -04:00
parent a87612b667
commit 133c4290c7
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59

View File

@ -113,6 +113,9 @@ func runOomKillerTest(f *framework.Framework, testCase testCase, kubeReservedMem
} }
ginkgo.BeforeEach(func() { ginkgo.BeforeEach(func() {
// Precautionary check that kubelet is healthy before running the test.
waitForKubeletToStart(context.TODO(), f)
ginkgo.By("setting up the pod to be used in the test") ginkgo.By("setting up the pod to be used in the test")
e2epod.NewPodClient(f).Create(context.TODO(), testCase.podSpec) e2epod.NewPodClient(f).Create(context.TODO(), testCase.podSpec)
}) })
@ -164,6 +167,7 @@ func getOOMTargetPod(podName string, ctnName string, createContainer func(name s
Name: podName, Name: podName,
}, },
Spec: v1.PodSpec{ Spec: v1.PodSpec{
PriorityClassName: "system-node-critical",
RestartPolicy: v1.RestartPolicyNever, RestartPolicy: v1.RestartPolicyNever,
Containers: []v1.Container{ Containers: []v1.Container{
createContainer(ctnName), createContainer(ctnName),
@ -268,7 +272,7 @@ func getOOMTargetContainerWithoutLimit(name string) v1.Container {
"sh", "sh",
"-c", "-c",
// use the dd tool to attempt to allocate huge block of memory which exceeds the node allocatable // use the dd tool to attempt to allocate huge block of memory which exceeds the node allocatable
"sleep 5 && dd if=/dev/zero of=/dev/null iflag=fullblock count=10 bs=10G", "sleep 5 && dd if=/dev/zero of=/dev/null iflag=fullblock count=10 bs=1024G",
}, },
SecurityContext: &v1.SecurityContext{ SecurityContext: &v1.SecurityContext{
SeccompProfile: &v1.SeccompProfile{ SeccompProfile: &v1.SeccompProfile{