Skip to content

Commit 44c6fbd

Browse files
committed
KEP-1287: PreferNoRestart
1 parent 584c14c commit 44c6fbd

File tree

1 file changed

+19
-13
lines changed
  • keps/sig-node/1287-in-place-update-pod-resources

1 file changed

+19
-13
lines changed

keps/sig-node/1287-in-place-update-pod-resources/README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -274,25 +274,25 @@ the `/resize` subresource:
274274
To provide fine-grained user control, PodSpec.Containers is extended with
275275
ResizeRestartPolicy - a list of named subobjects (new object) that supports
276276
'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.
279280
(e.g. Java process needs to change its Xmx flag) By using ResizePolicy, user
280281
can mark Containers as safe (or unsafe) for in-place resource update. Kubelet
281282
uses it to determine the required action.
282283

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.
286286

287287
Setting the flag to separately control CPU & memory is due to an observation
288288
that usually CPU can be added/removed without much problem whereas changes to
289289
available memory are more probable to require restarts.
290290

291291
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.
293293

294294
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
296296
in the container being stopped *and not restarted*, if the system can not
297297
perform the resize in place.
298298

@@ -340,6 +340,12 @@ As of Kubernetes v1.20, the CRI has included support for in-place resizing of co
340340
`ContainerStatus` message includes a `ContainerResources` field, which reports the current resource
341341
configuration of the container.
342342

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+
343349
Even though pod-level cgroups are currently managed by the Kubelet, runtimes may rely need to be
344350
notified when the resource configuration changes. For example, this information should be passed
345351
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
470476
### Flow Control
471477

472478
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.
474480
This is intentionally hitting various edge-cases to demonstrate.
475481

476482
```
@@ -1039,15 +1045,15 @@ Setup a namespace with min and max LimitRange and create a single, valid Pod.
10391045
#### Resize Policy Tests
10401046

10411047
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
10431049
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.
10451051
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,
10471053
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,
10491055
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,
10511057
verify container is resized with restart.
10521058

10531059
#### Backward Compatibility and Negative Tests

0 commit comments

Comments
 (0)