File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,9 @@ godebug default=go1.24
9
9
require (
10
10
github.com/google/go-cmp v0.7.0
11
11
github.com/stretchr/testify v1.10.0
12
- k8s.io/api v0.0.0-20250724224534-f2279712f874
12
+ k8s.io/api v0.0.0-20250725024533-ed2eb37e36f7
13
13
k8s.io/apimachinery v0.0.0-20250724224258-50e39b11cd32
14
- k8s.io/client-go v0.0.0-20250724224906-d4f2d5b8ccf7
14
+ k8s.io/client-go v0.0.0-20250725024913-6314d905defd
15
15
k8s.io/klog/v2 v2.130.1
16
16
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
17
17
)
Original file line number Diff line number Diff line change @@ -136,12 +136,12 @@ gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
136
136
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c /go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM =
137
137
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA =
138
138
gopkg.in/yaml.v3 v3.0.1 /go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM =
139
- k8s.io/api v0.0.0-20250724224534-f2279712f874 h1:AzVs/5TvK2r0BSsV33dVm4FLPgJEUybkjfLrEmiA7Ss =
140
- k8s.io/api v0.0.0-20250724224534-f2279712f874 /go.mod h1:h7pQu2oCQ3ccFA95Gaxuu7JO+0gHm6uxdKA4dLNL3Y8 =
139
+ k8s.io/api v0.0.0-20250725024533-ed2eb37e36f7 h1:pignGgNAV6vmwxzdSNqBSbV5Z/ZGZSmQ9rdKwM9tgvU =
140
+ k8s.io/api v0.0.0-20250725024533-ed2eb37e36f7 /go.mod h1:h7pQu2oCQ3ccFA95Gaxuu7JO+0gHm6uxdKA4dLNL3Y8 =
141
141
k8s.io/apimachinery v0.0.0-20250724224258-50e39b11cd32 h1:XbDM37tJSNp0ga7QZkizY+qxKJEA0DFe+nqssKruths =
142
142
k8s.io/apimachinery v0.0.0-20250724224258-50e39b11cd32 /go.mod h1:mjSAX6740hY31nMwwbFVIcjVaXzV46iZzqDA+UfugZ8 =
143
- k8s.io/client-go v0.0.0-20250724224906-d4f2d5b8ccf7 h1:C8WJw/YbIDqiA23gjDMRgBKsALuaO0i3iF2w574EpfU =
144
- k8s.io/client-go v0.0.0-20250724224906-d4f2d5b8ccf7 /go.mod h1:zKs1Ap5k23bvGabDhvkL2sweYIp3KNomdmyrhOBwvzo =
143
+ k8s.io/client-go v0.0.0-20250725024913-6314d905defd h1:j/vHpP95HSG+UbK+flgfRSOLIbLsf2oP40cO647d/a8 =
144
+ k8s.io/client-go v0.0.0-20250725024913-6314d905defd /go.mod h1:gyHUTPg2qWbNQYBEv+xZ6ymlwEelbEKLkxTFHLCBwO0 =
145
145
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk =
146
146
k8s.io/klog/v2 v2.130.1 /go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE =
147
147
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA =
Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ type PodResourcesOptions struct {
53
53
// from the calculation. If pod-level resources are not set in PodSpec,
54
54
// pod-level resources will always be skipped.
55
55
SkipPodLevelResources bool
56
+ // SkipContainerLevelResources
57
+ SkipContainerLevelResources bool
56
58
}
57
59
58
60
var supportedPodLevelResources = sets .New (v1 .ResourceCPU , v1 .ResourceMemory )
@@ -120,7 +122,11 @@ func IsPodLevelRequestsSet(pod *v1.Pod) bool {
120
122
// those pod-level values are used in calculating Pod Requests.
121
123
// The computation is part of the API and must be reviewed as an API change.
122
124
func PodRequests (pod * v1.Pod , opts PodResourcesOptions ) v1.ResourceList {
123
- reqs := AggregateContainerRequests (pod , opts )
125
+ reqs := v1.ResourceList {}
126
+ if ! opts .SkipContainerLevelResources {
127
+ reqs = AggregateContainerRequests (pod , opts )
128
+ }
129
+
124
130
if ! opts .SkipPodLevelResources && IsPodLevelRequestsSet (pod ) {
125
131
for resourceName , quantity := range pod .Spec .Resources .Requests {
126
132
if IsSupportedPodLevelResource (resourceName ) {
You can’t perform that action at this time.
0 commit comments