mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Merge pull request #130125 from marosset/windows-unit-tests-kubelet-eviction-fixes
fixing k8s.io/kubernetes/pkg/kubelet/eviction unit tests on Windows
This commit is contained in:
commit
83b696c720
@ -19,6 +19,7 @@ package eviction
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
goruntime "runtime"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -189,6 +190,7 @@ func makeMemoryStats(nodeAvailableBytes string, podStats map[*v1.Pod]statsapi.Po
|
|||||||
WorkingSetBytes: &WorkingSetBytes,
|
WorkingSetBytes: &WorkingSetBytes,
|
||||||
},
|
},
|
||||||
SystemContainers: []statsapi.ContainerStats{
|
SystemContainers: []statsapi.ContainerStats{
|
||||||
|
// Used for memory signal observations on linux
|
||||||
{
|
{
|
||||||
Name: statsapi.SystemContainerPods,
|
Name: statsapi.SystemContainerPods,
|
||||||
Memory: &statsapi.MemoryStats{
|
Memory: &statsapi.MemoryStats{
|
||||||
@ -196,6 +198,14 @@ func makeMemoryStats(nodeAvailableBytes string, podStats map[*v1.Pod]statsapi.Po
|
|||||||
WorkingSetBytes: &WorkingSetBytes,
|
WorkingSetBytes: &WorkingSetBytes,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// Used for memory signal observations on windows
|
||||||
|
{
|
||||||
|
Name: statsapi.SystemContainerWindowsGlobalCommitMemory,
|
||||||
|
Memory: &statsapi.MemoryStats{
|
||||||
|
AvailableBytes: &availableBytes,
|
||||||
|
UsageBytes: &WorkingSetBytes,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Pods: []statsapi.PodStats{},
|
Pods: []statsapi.PodStats{},
|
||||||
@ -354,6 +364,9 @@ func TestMemoryPressure_VerifyPodStatus(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPIDPressure_VerifyPodStatus(t *testing.T) {
|
func TestPIDPressure_VerifyPodStatus(t *testing.T) {
|
||||||
|
if goruntime.GOOS == "windows" {
|
||||||
|
t.Skip("PID pressure is not supported on Windows")
|
||||||
|
}
|
||||||
testCases := map[string]struct {
|
testCases := map[string]struct {
|
||||||
wantPodStatus v1.PodStatus
|
wantPodStatus v1.PodStatus
|
||||||
}{
|
}{
|
||||||
|
@ -31,6 +31,7 @@ func makeMemoryAvailableSignalObservation(summary *statsapi.Summary) *signalObse
|
|||||||
sysContainer, err := getSysContainer(summary.Node.SystemContainers, statsapi.SystemContainerWindowsGlobalCommitMemory)
|
sysContainer, err := getSysContainer(summary.Node.SystemContainers, statsapi.SystemContainerWindowsGlobalCommitMemory)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.ErrorS(err, "Eviction manager: failed to construct signal", "signal", evictionapi.SignalMemoryAvailable)
|
klog.ErrorS(err, "Eviction manager: failed to construct signal", "signal", evictionapi.SignalMemoryAvailable)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
if memory := sysContainer.Memory; memory != nil && memory.AvailableBytes != nil && memory.UsageBytes != nil {
|
if memory := sysContainer.Memory; memory != nil && memory.AvailableBytes != nil && memory.UsageBytes != nil {
|
||||||
klog.V(4).InfoS(
|
klog.V(4).InfoS(
|
||||||
|
Loading…
Reference in New Issue
Block a user