diff --git a/pkg/kubelet/eviction/eviction_manager_test.go b/pkg/kubelet/eviction/eviction_manager_test.go index 2befa71b945..a72c145409b 100644 --- a/pkg/kubelet/eviction/eviction_manager_test.go +++ b/pkg/kubelet/eviction/eviction_manager_test.go @@ -19,6 +19,7 @@ package eviction import ( "context" "fmt" + goruntime "runtime" "testing" "time" @@ -189,6 +190,7 @@ func makeMemoryStats(nodeAvailableBytes string, podStats map[*v1.Pod]statsapi.Po WorkingSetBytes: &WorkingSetBytes, }, SystemContainers: []statsapi.ContainerStats{ + // Used for memory signal observations on linux { Name: statsapi.SystemContainerPods, Memory: &statsapi.MemoryStats{ @@ -196,6 +198,14 @@ func makeMemoryStats(nodeAvailableBytes string, podStats map[*v1.Pod]statsapi.Po WorkingSetBytes: &WorkingSetBytes, }, }, + // Used for memory signal observations on windows + { + Name: statsapi.SystemContainerWindowsGlobalCommitMemory, + Memory: &statsapi.MemoryStats{ + AvailableBytes: &availableBytes, + UsageBytes: &WorkingSetBytes, + }, + }, }, }, Pods: []statsapi.PodStats{}, @@ -354,6 +364,9 @@ func TestMemoryPressure_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 { wantPodStatus v1.PodStatus }{ diff --git a/pkg/kubelet/eviction/helpers_windows.go b/pkg/kubelet/eviction/helpers_windows.go index ac3ea7f5302..85ab911c94f 100644 --- a/pkg/kubelet/eviction/helpers_windows.go +++ b/pkg/kubelet/eviction/helpers_windows.go @@ -31,6 +31,7 @@ func makeMemoryAvailableSignalObservation(summary *statsapi.Summary) *signalObse sysContainer, err := getSysContainer(summary.Node.SystemContainers, statsapi.SystemContainerWindowsGlobalCommitMemory) if err != nil { 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 { klog.V(4).InfoS(