mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/kube-vip/kube-vip.git
synced 2026-09-20 08:03:47 +08:00
fix(cmd): throw an error when no valid mode detected
Signed-off-by: Bohdan Leshchenko <bohdan.leshchenko1@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user