From 953358ba9a5793f0872eb1244d8228c00e6ef887 Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Tue, 20 Feb 2024 14:58:30 +0100 Subject: [PATCH] Error out when NLLB is enabled for a single-node cluster Using NLLB in a single-node cluster was never supported and documented as such since the inception of NLLB. K0s didn't error out early in this case, though. Signed-off-by: Tom Wieczorek (cherry picked from commit 7b7f94f4b1571d8523f7f9e6043f8c204308909f) --- cmd/worker/worker.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/worker/worker.go b/cmd/worker/worker.go index 0e1b5086504f..339414273b85 100644 --- a/cmd/worker/worker.go +++ b/cmd/worker/worker.go @@ -18,6 +18,7 @@ package worker import ( "context" + "errors" "fmt" "os" "os/signal" @@ -129,7 +130,11 @@ func (c *Command) Start(ctx context.Context) error { var staticPods worker.StaticPods - if !c.SingleNode && workerConfig.NodeLocalLoadBalancing.IsEnabled() { + if workerConfig.NodeLocalLoadBalancing.IsEnabled() { + if c.SingleNode { + return errors.New("node-local load balancing cannot be used in a single-node cluster") + } + sp := worker.NewStaticPods() reconciler, err := nllb.NewReconciler(c.K0sVars, sp, c.WorkerProfile, *workerConfig.DeepCopy()) if err != nil {