Skip to content

Commit 8a9b209

Browse files
authored
Merge pull request kubernetes#121706 from kannon92/fix-oom-swap-fedora
Skip OOMKilled Jobs if Swap is enabled.
2 parents d26c154 + 475bfa4 commit 8a9b209

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/e2e_node/oomkiller_linux_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import (
2424
v1 "k8s.io/api/core/v1"
2525
"k8s.io/apimachinery/pkg/api/resource"
2626
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27+
utilfeature "k8s.io/apiserver/pkg/util/feature"
28+
"k8s.io/kubernetes/pkg/features"
2729
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
2830
"k8s.io/kubernetes/test/e2e/framework"
2931
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
@@ -117,6 +119,18 @@ func runOomKillerTest(f *framework.Framework, testCase testCase, kubeReservedMem
117119
})
118120

119121
ginkgo.It("The containers terminated by OOM killer should have the reason set to OOMKilled", func() {
122+
cfg, configErr := getCurrentKubeletConfig(context.TODO())
123+
framework.ExpectNoError(configErr)
124+
if utilfeature.DefaultFeatureGate.Enabled(features.NodeSwap) {
125+
// If Swap is enabled, we should test OOM with LimitedSwap.
126+
// UnlimitedSwap allows for workloads to use unbounded swap which
127+
// makes testing OOM challenging.
128+
// We are not able to change the default for these conformance tests,
129+
// so we will skip these tests if swap is enabled.
130+
if cfg.MemorySwap.SwapBehavior == "" || cfg.MemorySwap.SwapBehavior == "UnlimitedSwap" {
131+
ginkgo.Skip("OOMKiller should not run with UnlimitedSwap")
132+
}
133+
}
120134
ginkgo.By("Waiting for the pod to be failed")
121135
err := e2epod.WaitForPodTerminatedInNamespace(context.TODO(), f.ClientSet, testCase.podSpec.Name, "", f.Namespace.Name)
122136
framework.ExpectNoError(err, "Failed waiting for pod to terminate, %s/%s", f.Namespace.Name, testCase.podSpec.Name)

0 commit comments

Comments
 (0)