Skip to content

Commit e90782b

Browse files
committed
fail LimitedSwap with cgroupv1
1 parent 3686ceb commit e90782b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmd/kubelet/app/server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,9 +802,11 @@ func run(ctx context.Context, s *options.KubeletServer, kubeDeps *kubelet.Depend
802802
}
803803
if utilfeature.DefaultFeatureGate.Enabled(features.NodeSwap) {
804804
if !isCgroup2UnifiedMode() && s.MemorySwap.SwapBehavior == kubelettypes.LimitedSwap {
805-
klog.InfoS("Swap feature is enabled and LimitedSwap but it is only supported with cgroupv2", "CGroupV2", isCgroup2UnifiedMode(), "SwapBehavior", s.MemorySwap.SwapBehavior)
805+
// This feature is not supported for cgroupv1 so we are failing early.
806+
return fmt.Errorf("swap feature is enabled and LimitedSwap but it is only supported with cgroupv2")
806807
}
807808
if !s.FailSwapOn && s.MemorySwap.SwapBehavior == "" {
809+
// This is just a log because we are using a default of NoSwap.
808810
klog.InfoS("NoSwap is set due to memorySwapBehavior not specified", "memorySwapBehavior", s.MemorySwap.SwapBehavior, "FailSwapOn", s.FailSwapOn)
809811
}
810812
}

0 commit comments

Comments
 (0)