Change:
As I was reading the test code, I noticed that we are missing a pretty large chunk of logic around localStorageCapacityIsolation. This feature was GA in 1.25 so it would be ideal to have unit test coverage around this code. This code monitors whether or not there is a violation in temporary storage and if there is it would evict the pod. One should be able to intiailize the manager with of true and then write some test cases to verify this behavior. /help /sig node /good-first-issue /kind bug
/cc do you have any recollection why there weren't tests for this path?
I can help with this. can you assign me after jingxu replies to you?(for more context here)
that would be great !
you're welcome. do you have any context here that why didn't cover localStorageCapacityIsolation?
I don't recall a specific reason. The feature was implemented a while back.
/assign
Hey Are you still working. If not can I take this up?
hi, yes I'm still working on it
hii I am new to k8s , so i wanna know can I use windows os for it? if yes would you show me how to get nodes...
hi, the answer is yes you can use windows and I think if you need support you better open another issue and @ me there, as this issue is not for discuss how to run k8s on windows
/remove-kind bug /kind feature /triage accepted
I see and I am wondering if we have duplicated efforts here. did you end up testing this path in our above PR?
Hey, is someone working on this issue ? or let me know if someone need help
Happy to help with this. Do you still need help
hey, is this currently still unassigned
has a ready for approval. /remove-good-first-issue /remove-help

Discussion:
return pod, podStats } <ins> func makePodWithLocalStorageCapacityIsolationOpen(name string, priority int32, requests v1.ResourceList, limits v1.ResourceList, memoryWorkingSet string) (*v1.Pod, statsapi.PodStats) { vol := newVolume("local-volume", v1.VolumeSource{ EmptyDir: &v1.EmptyDirVolumeSource{ SizeLimit: resource.NewQuantity(requests.Memory().Value(), resource.BinarySI), }, }) var vols []v1.Volume vols = append(vols, vol) pod := newPod(name, priority, []v1.Container{ newContainer(name, requests, limits), }, vols) var podStats statsapi.PodStats switch name { case "empty-dir": podStats = newPodMemoryStats(pod, *resource.NewQuantity(requests.Memory().Value()*2, resource.BinarySI)) case "container-ephemeral-storage-limit": podStats = newPodMemoryStats(pod, *resource.NewQuantity(limits.StorageEphemeral().Value(), resource.BinarySI)) case "pod-ephemeral-storage-limit": podStats = newPodMemoryStats(pod, *resource.NewQuantity(limits.StorageEphemeral().Value()*2, resource.BinarySI)) default: podStats = newPodMemoryStats(pod, resource.MustParse(memoryWorkingSet)) } return pod, podStats } </ins> func makeMemoryStats(nodeAvailableBytes string, podStats map[*v1.Pod]statsapi.PodStats) *statsapi.Summary { val := resource.MustParse(nodeAvailableBytes) availableBytes := uint64(val.Value())

fakeClock.Step(2 * notifierRefreshInterval) manager.synchronize(diskInfoProvider, activePodsFunc) } <ins> func TestManagerWithLocalStorageCapacityIsolationOpen(t *testing.T) { podMaker := makePodWithLocalStorageCapacityIsolationOpen summaryStatsMaker := makeDiskStats podsToMake := []podToMake{ {name: "empty-dir", requests: newResourceList("", "900Mi", ""), limits: newResourceList("", "1Gi", "")}, {name: "container-ephemeral-storage-limit", requests: newResourceList("", "", "900Mi"), limits: newResourceList("", "", "800Mi")}, {name: "pod-ephemeral-storage-limit", requests: newResourceList("", "", "1Gi"), limits: newResourceList("", "", "800Mi")}, } pods := []*v1.Pod{} podStats := map[*v1.Pod]statsapi.PodStats{} for _, podToMake := range podsToMake { pod, podStat := podMaker(podToMake.name, podToMake.priority, podToMake.requests, podToMake.limits, podToMake.memoryWorkingSet) pods = append(pods, pod) podStats[pod] = podStat } summaryProvider := &fakeSummaryProvider{result: summaryStatsMaker("1Gi", "200Mi", podStats)} config := Config{ MaxPodGracePeriodSeconds: 5, PressureTransitionPeriod: time.Minute * 5, Thresholds: []evictionapi.Threshold{ { Signal:   evictionapi.SignalAllocatableMemoryAvailable, Operator: evictionapi.OpLessThan, Value: evictionapi.ThresholdValue{ Quantity: quantityMustParse("1Gi"), }, }, }, } podKiller := &mockPodKiller{} diskGC := &mockDiskGC{err: nil} nodeRef := &v1.ObjectReference{Kind: "Node", Name: "test", UID: types.UID("test"), Namespace: ""} fakeClock := testingclock.NewFakeClock(time.Now()) diskInfoProvider := &mockDiskInfoProvider{dedicatedImageFs: false} mgr := &managerImpl{ clock:                         fakeClock, killPodFunc:                   podKiller.killPodNow, imageGC:                       diskGC, containerGC:                   diskGC, config:                        config, recorder:                      &record.FakeRecorder{}, summaryProvider:               summaryProvider, nodeRef:                       nodeRef, localStorageCapacityIsolation: true, dedicatedImageFs:              &diskInfoProvider.dedicatedImageFs, } activePodsFunc := func() []*v1.Pod { return pods } evictedPods := mgr.synchronize(diskInfoProvider, activePodsFunc) if podKiller.pod == nil { t.Fatalf("Manager should have selected a pod for eviction") } if diff := cmp.Diff(pods, evictedPods); diff != "" { t.Fatalf("Unexpected evicted pod (-want,+got):n%s", diff) } } </ins>

Memory: &statsapi.MemoryStats{ WorkingSetBytes: &workingSetBytes, }, <ins> VolumeStats: []statsapi.VolumeStats{ { FsStats: statsapi.FsStats{ UsedBytes: &workingSetBytes, }, Name: "local-volume", }, }, Containers: []statsapi.ContainerStats{ { Name: pod.Name, Logs: &statsapi.FsStats{ UsedBytes: &workingSetBytes, }, Rootfs: &statsapi.FsStats{UsedBytes: &workingSetBytes}, }, }, EphemeralStorage: &statsapi.FsStats{UsedBytes: &workingSetBytes}, </ins> } }