Skip to content

Commit

Permalink
Merge pull request kubernetes#123738 from kannon92/fail-limited-swap-…
Browse files Browse the repository at this point in the history
…cgroup-v1

[KEP-2400]: Fail limited swap cgroup v1
  • Loading branch information
k8s-ci-robot committed Mar 6, 2024
2 parents 2b521e5 + e90782b commit 546f7c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/kubelet/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -802,9 +802,11 @@ func run(ctx context.Context, s *options.KubeletServer, kubeDeps *kubelet.Depend
}
if utilfeature.DefaultFeatureGate.Enabled(features.NodeSwap) {
if !isCgroup2UnifiedMode() && s.MemorySwap.SwapBehavior == kubelettypes.LimitedSwap {
klog.InfoS("Swap feature is enabled and LimitedSwap but it is only supported with cgroupv2", "CGroupV2", isCgroup2UnifiedMode(), "SwapBehavior", s.MemorySwap.SwapBehavior)
// This feature is not supported for cgroupv1 so we are failing early.
return fmt.Errorf("swap feature is enabled and LimitedSwap but it is only supported with cgroupv2")
}
if !s.FailSwapOn && s.MemorySwap.SwapBehavior == "" {
// This is just a log because we are using a default of NoSwap.
klog.InfoS("NoSwap is set due to memorySwapBehavior not specified", "memorySwapBehavior", s.MemorySwap.SwapBehavior, "FailSwapOn", s.FailSwapOn)
}
}
Expand Down

0 comments on commit 546f7c3

Please sign in to comment.