Merge pull request #126066 from dims/tzneal-investigate-oom-test-failure-2

Fix for OOMKiller test consistently failing in EC2 cgroupv1 serial jobs
This commit is contained in:
Kubernetes Prow Robot 2024-07-14 05:45:09 -07:00 committed by GitHub
commit 8182305707
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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,7 +167,8 @@ func getOOMTargetPod(podName string, ctnName string, createContainer func(name s
Name: podName, Name: podName,
}, },
Spec: v1.PodSpec{ Spec: v1.PodSpec{
RestartPolicy: v1.RestartPolicyNever, PriorityClassName: "system-node-critical",
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{