From a9106c5806a612f61558e6a89a8336ba030baa25 Mon Sep 17 00:00:00 2001 From: Sergey Melnikov Date: Thu, 6 Jun 2024 12:31:12 +0200 Subject: [PATCH 1/2] Fix k3s cluster detection --- neonvm/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neonvm/main.go b/neonvm/main.go index d27233857..9f00e9110 100644 --- a/neonvm/main.go +++ b/neonvm/main.go @@ -24,6 +24,7 @@ import ( "net/http" "os" "os/signal" + "strings" "syscall" "time" @@ -245,7 +246,7 @@ func checkIfRunningInK3sCluster(cfg *rest.Config) (bool, error) { } for _, node := range nodes.Items { - if node.Status.NodeInfo.OSImage == "K3s dev" { + if strings.Contains(node.Status.NodeInfo.OSImage, "K3s") { return true, nil } } From 55a5ad3bebfa51d439d48aa16dd387adf4baa74e Mon Sep 17 00:00:00 2001 From: Sergey Melnikov Date: Thu, 6 Jun 2024 17:39:05 +0200 Subject: [PATCH 2/2] Use HasPrefix instead of Contains --- neonvm/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neonvm/main.go b/neonvm/main.go index 9f00e9110..c0fdd4650 100644 --- a/neonvm/main.go +++ b/neonvm/main.go @@ -246,7 +246,7 @@ func checkIfRunningInK3sCluster(cfg *rest.Config) (bool, error) { } for _, node := range nodes.Items { - if strings.Contains(node.Status.NodeInfo.OSImage, "K3s") { + if strings.HasPrefix(node.Status.NodeInfo.OSImage, "K3s") { return true, nil } }