diff --git a/CHANGELOG/CHANGELOG-1.27.md b/CHANGELOG/CHANGELOG-1.27.md index e939277a2ce..747fee925a5 100644 --- a/CHANGELOG/CHANGELOG-1.27.md +++ b/CHANGELOG/CHANGELOG-1.27.md @@ -153,7 +153,7 @@ name | architectures - PodSpec.Container.Resources becomes mutable for CPU and memory resource types. - PodSpec.Container.ResizePolicy (new object) gives users control over how their containers are resized. - PodStatus.Resize status describes the state of a requested Pod resize. - - PodStatus.ResourcesAllocated describes node resources allocated to Pod. + - PodStatus.AllocatedResources describes node resources allocated to Pod. - PodStatus.Resources describes node resources applied to running containers by CRI. - UpdateContainerResources CRI API now supports both Linux and Windows. @@ -640,4 +640,4 @@ name | architectures ### Removed - github.com/elazarl/goproxy: [947c36d](https://github.com/elazarl/goproxy/tree/947c36d) -- github.com/mindprince/gonvml: [9ebdce4](https://github.com/mindprince/gonvml/tree/9ebdce4) \ No newline at end of file +- github.com/mindprince/gonvml: [9ebdce4](https://github.com/mindprince/gonvml/tree/9ebdce4) diff --git a/pkg/api/v1/resource/helpers.go b/pkg/api/v1/resource/helpers.go index 2144731c815..4ed0b33d080 100644 --- a/pkg/api/v1/resource/helpers.go +++ b/pkg/api/v1/resource/helpers.go @@ -65,9 +65,9 @@ func PodRequests(pod *v1.Pod, opts PodResourcesOptions) v1.ResourceList { cs, found := containerStatuses[container.Name] if found { if pod.Status.Resize == v1.PodResizeStatusInfeasible { - containerReqs = cs.ResourcesAllocated + containerReqs = cs.AllocatedResources } else { - containerReqs = max(container.Resources.Requests, cs.ResourcesAllocated) + containerReqs = max(container.Resources.Requests, cs.AllocatedResources) } } } diff --git a/pkg/api/v1/resource/helpers_test.go b/pkg/api/v1/resource/helpers_test.go index 4d3654a9497..74820b52c45 100644 --- a/pkg/api/v1/resource/helpers_test.go +++ b/pkg/api/v1/resource/helpers_test.go @@ -737,7 +737,7 @@ func TestPodResourceRequests(t *testing.T) { containerStatus: []v1.ContainerStatus{ { Name: "container-1", - ResourcesAllocated: v1.ResourceList{ + AllocatedResources: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("2"), }, }, @@ -762,7 +762,7 @@ func TestPodResourceRequests(t *testing.T) { containerStatus: []v1.ContainerStatus{ { Name: "container-1", - ResourcesAllocated: v1.ResourceList{ + AllocatedResources: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("2"), }, }, @@ -788,7 +788,7 @@ func TestPodResourceRequests(t *testing.T) { containerStatus: []v1.ContainerStatus{ { Name: "container-1", - ResourcesAllocated: v1.ResourceList{ + AllocatedResources: v1.ResourceList{ v1.ResourceCPU: resource.MustParse("2"), }, },