From 631c0ad5bf152e05f236a37cc25f1960ab274394 Mon Sep 17 00:00:00 2001 From: Jaehyun Nam Date: Fri, 20 May 2022 12:29:50 +0000 Subject: [PATCH] fix hostname Signed-off-by: Jaehyun Nam --- KubeArmor/config/config.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KubeArmor/config/config.go b/KubeArmor/config/config.go index e5a913a685..4c7c299a18 100644 --- a/KubeArmor/config/config.go +++ b/KubeArmor/config/config.go @@ -5,6 +5,7 @@ package config import ( "os" + "strings" "flag" @@ -90,7 +91,7 @@ const ConfigK8sEnv string = "k8s" func readCmdLineParams() { hostname, _ := os.Hostname() clusterStr := flag.String(ConfigCluster, "default", "cluster name") - hostStr := flag.String(ConfigHost, hostname, "host name") + hostStr := flag.String(ConfigHost, strings.Split(hostname, ".")[0], "host name") grpcStr := flag.String(ConfigGRPC, "32767", "gRPC port number") logStr := flag.String(ConfigLogPath, "/tmp/kubearmor.log", "log file path, {path|stdout|none}")