Commit 85775105 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #44520 from dashpole/test_eviction_fix

Automatic merge from submit-queue (batch tested with PRs 44520, 45253, 45838, 44685, 45901) Ensure ordering of using dynamic kubelet config and setting up tests. This PR simply places the body of the eviction test within its own context. This ensures that the kubelet config is set before the pods are created, and that the kubelet config is reverted only after the pods are deleted.
parents d823a6e2 9f098a9c
...@@ -65,16 +65,22 @@ var _ = framework.KubeDescribe("AllocatableEviction [Slow] [Serial] [Disruptive] ...@@ -65,16 +65,22 @@ var _ = framework.KubeDescribe("AllocatableEviction [Slow] [Serial] [Disruptive]
} }
evictionTestTimeout := 40 * time.Minute evictionTestTimeout := 40 * time.Minute
testCondition := "Memory Pressure" testCondition := "Memory Pressure"
kubeletConfigUpdate := func(initialConfig *componentconfig.KubeletConfiguration) {
initialConfig.EvictionHard = "memory.available<10%" Context(fmt.Sprintf("when we run containers that should cause %s", testCondition), func() {
// Set large system and kube reserved values to trigger allocatable thresholds far before hard eviction thresholds. tempSetCurrentKubeletConfig(f, func(initialConfig *componentconfig.KubeletConfiguration) {
initialConfig.SystemReserved = componentconfig.ConfigurationMap(map[string]string{"memory": "1Gi"}) initialConfig.EvictionHard = "memory.available<10%"
initialConfig.KubeReserved = componentconfig.ConfigurationMap(map[string]string{"memory": "1Gi"}) // Set large system and kube reserved values to trigger allocatable thresholds far before hard eviction thresholds.
initialConfig.EnforceNodeAllocatable = []string{cm.NodeAllocatableEnforcementKey} initialConfig.SystemReserved = componentconfig.ConfigurationMap(map[string]string{"memory": "1Gi"})
initialConfig.ExperimentalNodeAllocatableIgnoreEvictionThreshold = false initialConfig.KubeReserved = componentconfig.ConfigurationMap(map[string]string{"memory": "1Gi"})
initialConfig.CgroupsPerQOS = true initialConfig.EnforceNodeAllocatable = []string{cm.NodeAllocatableEnforcementKey}
} initialConfig.ExperimentalNodeAllocatableIgnoreEvictionThreshold = false
runEvictionTest(f, testCondition, podTestSpecs, evictionTestTimeout, hasMemoryPressure, kubeletConfigUpdate) initialConfig.CgroupsPerQOS = true
})
// Place the remainder of the test within a context so that the kubelet config is set before and after the test.
Context("With kubeconfig updated", func() {
runEvictionTest(f, testCondition, podTestSpecs, evictionTestTimeout, hasMemoryPressure)
})
})
}) })
// Returns TRUE if the node has Memory Pressure, FALSE otherwise // Returns TRUE if the node has Memory Pressure, FALSE otherwise
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment