fix(cmd): throw an error when no valid mode detected

Signed-off-by: Bohdan Leshchenko <bohdan.leshchenko1@gmail.com>
This commit is contained in:
Bohdan Leshchenko
2026-07-24 13:26:40 +02:00
parent 3294dccbc2
commit 2e4b92a2ed

View File

@@ -359,21 +359,38 @@ var kubeVipManager = &cobra.Command{
}
// Determine the kube-vip mode
var mode string
var (
mode string
modesEnabled int
)
if initConfig.EnableARP {
mode = "ARP"
modesEnabled++
}
if initConfig.EnableBGP {
mode = "BGP"
modesEnabled++
}
if initConfig.EnableWireguard {
mode = "Wireguard"
modesEnabled++
}
if initConfig.EnableRoutingTable {
mode = "Routing Table"
modesEnabled++
}
if mode == "" {
log.Error("no valid kube-vip mode detected, ensure a supported mode is configured")
return
}
if modesEnabled > 1 {
log.Error("multiple kube-vip modes detected, ensure only one mode is configured")
return
}
// Provide configuration to output/logging