Skip to content

Commit 15eabc8

Browse files
committed
Update KEP with API review feedback
1 parent 27c3038 commit 15eabc8

File tree

1 file changed

+38
-23
lines changed

1 file changed

+38
-23
lines changed

keps/sig-node/2400-node-swap/README.md

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ There are hence a number of possible ways that one could envision swap use on a
9797

9898
### Scenarios
9999

100-
1. Swap is enabled only at the system level. The CRI does not permit user workloads to use swap. (This scenario is a prerequisite for the following use cases.)
100+
1. Swap is enabled on a node's host system, but the CRI does not permit Kubernetes workloads to use swap. (This scenario is a prerequisite for the following use cases.)
101101
1. Swap is enabled at the node level. The CRI can be globally configured to permit user workloads scheduled on the node to use some quantity of swap.
102102
1. Swap is set on a per-workload basis. The CRI sets permitted swap utilization on each individual workload.
103103

@@ -245,33 +245,46 @@ type KubeletConfiguration struct {
245245
metav1.TypeMeta
246246
...
247247
// Configure swap memory available to container workloads.
248-
// If not set, workloads cannot use swap.
249-
// If set to 0, workloads can use as much swap as their memory limit.
250-
// If set to -1, workloads can use unlimited swap, up to the system limit.
251-
// If set to a positive integer, workloads can use a total of memory and swap up to this
252-
// limit. When containers request more memory than this limit, they cannot use swap.
253248
// +featureGate=NodeSwapEnabled
254249
// +optional
255-
MemorySwapLimit *int64
250+
MemorySwap MemorySwapConfiguration
251+
}
252+
253+
type MemorySwapConfiguration struct {
254+
// Configure swap memory available to container workloads. May be one of
255+
// "", "NoSwap": workloads cannot use swap
256+
// "WorkloadSpecifiedSwapLimit": workloads can use as much swap as their memory limit.
257+
// "UnlimitedSwap": workloads can use unlimited swap, up to the system limit.
258+
// "LimitedSwap": workloads can use a total of memory and swap up to this
259+
// limit. When containers request more memory than this limit, they cannot use swap.
260+
SwapBehavior string
261+
262+
LimitedSwap *LimitedSwapConfiguration
263+
}
264+
265+
type LimitedSwapConfiguration struct {
266+
PerWorkloadMemorySwapLimit resource.Quantity
256267
}
257268
```
258269

259-
For container with memory limit set, MemorySwapLimit setting will have the
260-
following effects, following the [Docker] and open container specification:
261-
262-
* If `MemorySwapLimit` is not set, containers do not have access to swap. This
263-
value effectively prevents a container from using swap, even if it is enabled
264-
on a system.
265-
* If `MemorySwapLimit` is set to 0, for containers with memory limit is set, the
266-
container can use as much swap as its memory limit setting. For instance, if
267-
a container requests 300Mi memory and `MemorySwapLimit` is not set, the
268-
container can use 600Mi total memory and swap.
269-
* If `MemorySwapLimit` is set to -1, the container is allowed to use
270-
unlimited swap, up to the maximum amount available on the host system.
271-
* If `MemorySwapLimit` is set to a positive integer, then for containers with a
272-
memory limit set, that value represents the system-wide maximum limit for
273-
combined memory and swap usage of a container. For example, if
274-
`MemorySwapLimit` is set to 1073742000 (1Gi):
270+
The `MemorySwapConfiguration.SwapBehavior` setting will have the following
271+
effects, based on the [Docker] and open container specification for the
272+
`--memory-swap` flag:
273+
274+
* If `SwapBehavior` is not set or set to `"NoSwap"`, containers do not have
275+
access to swap. This value effectively prevents a container from using swap,
276+
even if it is enabled on a system.
277+
* If `SwapBehavior` is set to `"WorkloadSpecifiedSwapLimit"`, then for
278+
containers with memory limit is set, the container can use as much swap as
279+
its memory limit setting. For instance, if a container requests 300Mi memory
280+
and `MemorySwapLimit` is not set, the container can use 600Mi total memory
281+
and swap.
282+
* If `SwapBehavior` is set to `"UnlimitedSwap"`, the container is allowed to
283+
use unlimited swap, up to the maximum amount available on the host system.
284+
* If `SwapBehavior` is set to a `"LimitedSwap"`, then the `LimitedSwap`
285+
configuration must also be set. `LimitedSwap.PerWorkloadMemorySwapLimit`
286+
represents the system-wide maximum limit for combined memory and swap usage
287+
of a container. For example, if the limit is set to `1Gi`:
275288
* If the container's memory limit is 300Mi, it can use 1Gi combined memory
276289
and swap (e.g. up to 700Mi swap).
277290
* If the container's memory limit is 700Mi, it can use 1Gi combined memory
@@ -309,6 +322,7 @@ For alpha:
309322
- Swap scenarios are enabled in test-infra for at least two Linux distributions. e2e suites will be run against them.
310323
- Container runtimes must be bumped in CI to use the new CRI.
311324
- Data should be gathered from a number of use cases to guide beta graduation and further development efforts.
325+
- Focus should be on supported user stories as listed above.
312326

313327
Once this data is available, additional test plans should be added for the next phase of graduation.
314328

@@ -331,6 +345,7 @@ Once this data is available, additional test plans should be added for the next
331345

332346
#### GA
333347

348+
- Test a wide variety of scenarios that may be affected by swap support, such as workloads using tmpfs storage.
334349
- Remove feature flag.
335350

336351
### Upgrade / Downgrade Strategy

0 commit comments

Comments
 (0)