From b0477bc37fb39859d3aa9f9c82a953c2ceda4010 Mon Sep 17 00:00:00 2001 From: Yoann La Cancellera Date: Thu, 5 Oct 2023 13:29:42 +0200 Subject: [PATCH] Fix: don't cut node name if it's an ip rare case, but it was not producing great results regression tests will come for this --- src/go/pt-galera-log-explainer/utils/utils.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/go/pt-galera-log-explainer/utils/utils.go b/src/go/pt-galera-log-explainer/utils/utils.go index 900acf7d..f4c25d61 100644 --- a/src/go/pt-galera-log-explainer/utils/utils.go +++ b/src/go/pt-galera-log-explainer/utils/utils.go @@ -3,6 +3,8 @@ package utils import ( "fmt" "strings" + + "k8s.io/utils/net" ) // Color is given its own type for safe function signatures @@ -118,6 +120,10 @@ func ShortNodeName(s string) string { if len(s) < 10 { return s } + // for the rare case of having IPs set as node names + if net.IsIPv4String(s) { + return s + } before, _, _ := strings.Cut(s, ".") return before }