@@ -274,25 +274,25 @@ the `/resize` subresource:
274
274
To provide fine-grained user control, PodSpec.Containers is extended with
275
275
ResizeRestartPolicy - a list of named subobjects (new object) that supports
276
276
'cpu' and 'memory' as names. It supports the following restart policy values:
277
- * NotRequired - default value; resize the Container without restart, if possible.
278
- * RestartContainer - the container requires a restart to apply new resource values.
277
+ * ` PreferNoRestart ` - default value; resize the Container without restart, if possible.
278
+ * ` NotRequired ` - Equivalent to ` PreferNoRestart ` , deprecated with v1.33.
279
+ * ` RestartContainer ` - the container requires a restart to apply new resource values.
279
280
(e.g. Java process needs to change its Xmx flag) By using ResizePolicy, user
280
281
can mark Containers as safe (or unsafe) for in-place resource update. Kubelet
281
282
uses it to determine the required action.
282
283
283
- Note: ` NotRequired ` restart policy for resize does not * guarantee* that a container
284
- won't be restarted. The runtime may choose to stop the container if it is unable to
285
- apply the new resources without restarts.
284
+ Note: ` PreferNoRestart ` restart policy for resize does not * guarantee* that a container
285
+ won't be restarted.
286
286
287
287
Setting the flag to separately control CPU & memory is due to an observation
288
288
that usually CPU can be added/removed without much problem whereas changes to
289
289
available memory are more probable to require restarts.
290
290
291
291
If more than one resource type with different policies are updated at the same
292
- time, then ` RestartContainer ` policy takes precedence over ` NotRequired ` policy.
292
+ time, then ` RestartContainer ` policy takes precedence over ` PreferNoRestart ` policy.
293
293
294
294
If a pod's RestartPolicy is ` Never ` , the ResizePolicy fields must be set to
295
- ` NotRequired ` to pass validation. That said, any in-place resize may result
295
+ ` PreferNoRestart ` to pass validation. That said, any in-place resize may result
296
296
in the container being stopped * and not restarted* , if the system can not
297
297
perform the resize in place.
298
298
@@ -340,6 +340,12 @@ As of Kubernetes v1.20, the CRI has included support for in-place resizing of co
340
340
` ContainerStatus ` message includes a ` ContainerResources ` field, which reports the current resource
341
341
configuration of the container.
342
342
343
+ Starting with Kubernetes v1.33, the contract on the ` UpdateContainerResources ` call will be updated
344
+ to specify that runtimes should not deliberately restart the container to adjust the resources. If a
345
+ restart is required to resize, the runtime should return an error instead. There may be edge-cases
346
+ where a restart can still be triggered (see [ Memory Limit Decreases] ( #memory-limit-decreases ) ), so
347
+ this is a best-effort requirement. There is no enforcement of this behavior.
348
+
343
349
Even though pod-level cgroups are currently managed by the Kubelet, runtimes may rely need to be
344
350
notified when the resource configuration changes. For example, this information should be passed
345
351
through to NRI plugins. To this end, we will add a new ` UpdatePodSandboxResources ` API:
@@ -470,7 +476,7 @@ the larger of the Pod's `Spec...Resources.Requests` and
470
476
### Flow Control
471
477
472
478
The following steps denote the flow of a series of in-place resize operations
473
- for a Pod with ResizePolicy set to NotRequired for all its Containers.
479
+ for a Pod with ResizePolicy set to PreferNoRestart for all its Containers.
474
480
This is intentionally hitting various edge-cases to demonstrate.
475
481
476
482
```
@@ -1039,15 +1045,15 @@ Setup a namespace with min and max LimitRange and create a single, valid Pod.
1039
1045
#### Resize Policy Tests
1040
1046
1041
1047
Setup a guaranteed class Pod with two containers (c1 & c2).
1042
- 1 . No resize policy specified, defaults to NotRequired . Verify that CPU and
1048
+ 1 . No resize policy specified, defaults to PreferNoRestart . Verify that CPU and
1043
1049
memory are resized without restarting containers.
1044
- 1 . NotRequired (cpu, memory) policy for c1, RestartContainer (cpu, memory) for c2.
1050
+ 1 . PreferNoRestart (cpu, memory) policy for c1, RestartContainer (cpu, memory) for c2.
1045
1051
Verify that c1 is resized without restart, c2 is restarted on resize.
1046
- 1 . NotRequired cpu, RestartContainer memory policy for c1. Resize c1 CPU only,
1052
+ 1 . PreferNoRestart cpu, RestartContainer memory policy for c1. Resize c1 CPU only,
1047
1053
verify container is resized without restart.
1048
- 1 . NotRequired cpu, RestartContainer memory policy for c1. Resize c1 memory only,
1054
+ 1 . PreferNoRestart cpu, RestartContainer memory policy for c1. Resize c1 memory only,
1049
1055
verify container is resized with restart.
1050
- 1 . NotRequired cpu, RestartContainer memory policy for c1. Resize c1 CPU & memory,
1056
+ 1 . PreferNoRestart cpu, RestartContainer memory policy for c1. Resize c1 CPU & memory,
1051
1057
verify container is resized with restart.
1052
1058
1053
1059
#### Backward Compatibility and Negative Tests
0 commit comments