@@ -616,24 +616,20 @@ type KubeletConfiguration struct {
616
616
}
617
617
618
618
type MemorySwapConfiguration struct {
619
- // Configure swap memory available to container workloads. May be one of
620
- // "", "NoSwap": workload will not use swap
621
- // "LimitedSwap": workload combined memory and swap usage cannot exceed pod memory limit
622
- SwapBehavior string
623
- }
619
+ // swapBehavior configures swap memory available to container workloads. May be one of
620
+ // "", "NoSwap": workloads can not use swap, default option.
621
+ // "LimitedSwap": workload swap usage is limited. The swap limit is proportionate to the container's memory request.
622
+ // +featureGate=NodeSwap
623
+ // +optional
624
+ SwapBehavior string `json:"swapBehavior,omitempty"`}
624
625
```
625
626
626
627
We want to expose common swap configurations based on the [ Docker] and open
627
628
container specification for the ` --memory-swap ` flag. Thus, the
628
629
` MemorySwapConfiguration.SwapBehavior ` setting will have the following effects:
629
630
630
- * If ` SwapBehavior ` is set to ` "LimitedSwap" ` , containers do not have
631
- access to swap beyond their memory limit. This value prevents a container
632
- from using swap in excess of their memory limit, even if it is enabled on a
633
- system.
634
- * With cgroups v2, swap is configured independently from memory. Thus, the
635
- container runtimes can set [ ` memory.swap.max ` ] to 0 in this case, and _ no_ swap
636
- usage will be permitted.
631
+ * If ` SwapBehavior ` is set to ` "LimitedSwap" ` , containers have limited (or no) swap access.
632
+ See "Steps to Calculate Swap Limit" above.
637
633
* If ` SwapBehavior ` is set to ` "" ` or ` "NoSwap" ` , no workloads will utilize swap.
638
634
639
635
[ docker ] : https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details
0 commit comments