You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: keps/sig-node/2400-node-swap/README.md
+38-23Lines changed: 38 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,7 +97,7 @@ There are hence a number of possible ways that one could envision swap use on a
97
97
98
98
### Scenarios
99
99
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.)
101
101
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.
102
102
1. Swap is set on a per-workload basis. The CRI sets permitted swap utilization on each individual workload.
103
103
@@ -245,33 +245,46 @@ type KubeletConfiguration struct {
245
245
metav1.TypeMeta
246
246
...
247
247
// 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.
253
248
// +featureGate=NodeSwapEnabled
254
249
// +optional
255
-
MemorySwapLimit *int64
250
+
MemorySwapMemorySwapConfiguration
251
+
}
252
+
253
+
typeMemorySwapConfigurationstruct {
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
+
SwapBehaviorstring
261
+
262
+
LimitedSwap *LimitedSwapConfiguration
263
+
}
264
+
265
+
typeLimitedSwapConfigurationstruct {
266
+
PerWorkloadMemorySwapLimit resource.Quantity
256
267
}
257
268
```
258
269
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`:
275
288
* If the container's memory limit is 300Mi, it can use 1Gi combined memory
276
289
and swap (e.g. up to 700Mi swap).
277
290
* If the container's memory limit is 700Mi, it can use 1Gi combined memory
@@ -309,6 +322,7 @@ For alpha:
309
322
- Swap scenarios are enabled in test-infra for at least two Linux distributions. e2e suites will be run against them.
310
323
- Container runtimes must be bumped in CI to use the new CRI.
311
324
- 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.
312
326
313
327
Once this data is available, additional test plans should be added for the next phase of graduation.
314
328
@@ -331,6 +345,7 @@ Once this data is available, additional test plans should be added for the next
331
345
332
346
#### GA
333
347
348
+
- Test a wide variety of scenarios that may be affected by swap support, such as workloads using tmpfs storage.
0 commit comments