Clean up host-gw variable names

pull/1137/head
Erik Wilson 2019-11-27 10:25:55 -07:00
parent c23f12765e
commit 7675f9f85c
3 changed files with 8 additions and 7 deletions

View File

@ -44,14 +44,15 @@ const (
"Backend": %backend%
}
`
hostGwBackend = `{
"Type": "host-gw"
}`
vxlanBackend = `{
"Type": "vxlan"
}`
hostGWBackend = `{
"Type": "host-gw"
}`
ipsecBackend = `{
"Type": "ipsec",
"UDPEncap": true,
@ -123,6 +124,8 @@ func createFlannelConf(nodeConfig *config.Node) error {
switch nodeConfig.FlannelBackend {
case config.FlannelBackendVXLAN:
backendConf = vxlanBackend
case config.FlannelBackendHostGW:
backendConf = hostGWBackend
case config.FlannelBackendIPSEC:
backendConf = strings.Replace(ipsecBackend, "%psk%", nodeConfig.AgentConfig.IPSECPSK, -1)
if err := setupStrongSwan(nodeConfig); err != nil {
@ -130,8 +133,6 @@ func createFlannelConf(nodeConfig *config.Node) error {
}
case config.FlannelBackendWireguard:
backendConf = wireguardBackend
case config.FlannelBackendHOSTGW:
backendConf = hostGwBackend
default:
return fmt.Errorf("Cannot configure unknown flannel backend '%s'", nodeConfig.FlannelBackend)
}

View File

@ -114,7 +114,7 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
},
cli.StringFlag{
Name: "flannel-backend",
Usage: fmt.Sprintf("(networking) One of 'none', 'vxlan', 'ipsec', 'hostgw', or 'wireguard'"),
Usage: fmt.Sprintf("(networking) One of 'none', 'vxlan', 'ipsec', 'host-gw', or 'wireguard'"),
Destination: &ServerConfig.FlannelBackend,
Value: "vxlan",
},

View File

@ -16,9 +16,9 @@ import (
const (
FlannelBackendNone = "none"
FlannelBackendVXLAN = "vxlan"
FlannelBackendHostGW = "host-gw"
FlannelBackendIPSEC = "ipsec"
FlannelBackendWireguard = "wireguard"
FlannelBackendHOSTGW = "hostgw"
)
type Node struct {