mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #31200 from ronnielai/test1
Automatic merge from submit-queue Skip disk eviction test on non-supported images.
This commit is contained in:
commit
f0462c4043
@ -169,6 +169,6 @@ func RegisterNodeFlags() {
|
|||||||
flag.BoolVar(&TestContext.DisableKubenet, "disable-kubenet", false, "If true, start kubelet without kubenet. (default false)")
|
flag.BoolVar(&TestContext.DisableKubenet, "disable-kubenet", false, "If true, start kubelet without kubenet. (default false)")
|
||||||
// TODO: uncomment this when the flag is re-enabled in kubelet
|
// TODO: uncomment this when the flag is re-enabled in kubelet
|
||||||
//flag.BoolVar(&TestContext.CgroupsPerQOS, "cgroups-per-qos", false, "Enable creation of QoS cgroup hierarchy, if true top level QoS and pod cgroups are created.")
|
//flag.BoolVar(&TestContext.CgroupsPerQOS, "cgroups-per-qos", false, "Enable creation of QoS cgroup hierarchy, if true top level QoS and pod cgroups are created.")
|
||||||
flag.StringVar(&TestContext.EvictionHard, "eviction-hard", "memory.available<250Mi,imagefs.available<10%%", "The hard eviction thresholds. If set, pods get evicted when the specified resources drop below the thresholds.")
|
flag.StringVar(&TestContext.EvictionHard, "eviction-hard", "memory.available<250Mi,imagefs.available<10%", "The hard eviction thresholds. If set, pods get evicted when the specified resources drop below the thresholds.")
|
||||||
flag.StringVar(&TestContext.ManifestPath, "manifest-path", "", "The path to the static pod manifest file.")
|
flag.StringVar(&TestContext.ManifestPath, "manifest-path", "", "The path to the static pod manifest file.")
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ var _ = framework.KubeDescribe("Kubelet Eviction Manager [Serial] [Disruptive]",
|
|||||||
})
|
})
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
if !evictionOptionIsSet() {
|
if !isImageSupported() || !evictionOptionIsSet() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,6 +97,10 @@ var _ = framework.KubeDescribe("Kubelet Eviction Manager [Serial] [Disruptive]",
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("should evict the pod using the most disk space [Slow]", func() {
|
It("should evict the pod using the most disk space [Slow]", func() {
|
||||||
|
if !isImageSupported() {
|
||||||
|
framework.Logf("test skipped because the image is not supported by the test")
|
||||||
|
return
|
||||||
|
}
|
||||||
if !evictionOptionIsSet() {
|
if !evictionOptionIsSet() {
|
||||||
framework.Logf("test skipped because eviction option is not set")
|
framework.Logf("test skipped because eviction option is not set")
|
||||||
return
|
return
|
||||||
@ -217,3 +221,9 @@ func recordContainerId(containersToCleanUp map[string]bool, containerStatuses []
|
|||||||
func evictionOptionIsSet() bool {
|
func evictionOptionIsSet() bool {
|
||||||
return len(framework.TestContext.EvictionHard) > 0
|
return len(framework.TestContext.EvictionHard) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isImageSupported() bool {
|
||||||
|
// TODO: Only images with image fs is selected for testing for now. When the kubelet settings can be dynamically updated,
|
||||||
|
// instead of skipping images the eviction thresholds should be adjusted based on the images.
|
||||||
|
return strings.Contains(framework.TestContext.NodeName, "-gci-dev-")
|
||||||
|
}
|
||||||
|
@ -347,6 +347,7 @@ func (es *e2eService) startKubeletServer() (*server, error) {
|
|||||||
es.logFiles["kubelet.log"] = logFileData{
|
es.logFiles["kubelet.log"] = logFileData{
|
||||||
journalctlCommand: []string{"-u", unitName},
|
journalctlCommand: []string{"-u", unitName},
|
||||||
}
|
}
|
||||||
|
framework.TestContext.EvictionHard = adjustConfigForSystemd(framework.TestContext.EvictionHard)
|
||||||
} else {
|
} else {
|
||||||
cmdArgs = append(cmdArgs, getKubeletServerBin())
|
cmdArgs = append(cmdArgs, getKubeletServerBin())
|
||||||
cmdArgs = append(cmdArgs,
|
cmdArgs = append(cmdArgs,
|
||||||
@ -705,3 +706,7 @@ func (s *server) kill() error {
|
|||||||
|
|
||||||
return fmt.Errorf("unable to stop %q", name)
|
return fmt.Errorf("unable to stop %q", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func adjustConfigForSystemd(config string) string {
|
||||||
|
return strings.Replace(config, "%", "%%", -1)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user