mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-29 03:51:54 +08:00
feat(host): add option OvnEncapIpDetectionMethod can-reach:xx
This commit is contained in:
@@ -17,6 +17,7 @@ package hostinfo
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
@@ -71,10 +72,18 @@ func (oh *OvnHelper) mustPrepOvsdbConfig() {
|
||||
{
|
||||
encapIp := opts.OvnEncapIp
|
||||
if encapIp == "" {
|
||||
var err error
|
||||
encapIp, err = netutils2.MyIP()
|
||||
var (
|
||||
err error
|
||||
meth = opts.OvnEncapIpDetectionMethod
|
||||
)
|
||||
switch {
|
||||
case strings.HasPrefix(meth, "can-reach:"):
|
||||
encapIp, err = netutils2.MyIPTo(meth[10:])
|
||||
default:
|
||||
encapIp, err = netutils2.MyIP()
|
||||
}
|
||||
if err != nil {
|
||||
panic(errors.Wrap(ErrOvnConfig, "determine default encap ip"))
|
||||
panic(errors.Wrapf(ErrOvnConfig, "determine encap ip, method: %q: %v", meth, err))
|
||||
}
|
||||
}
|
||||
args = append(args, "external_ids:ovn-encap-type=geneve")
|
||||
|
||||
@@ -123,12 +123,13 @@ type SHostOptions struct {
|
||||
SdnEnableGuestMan bool `help:"enable guest network manager in sdnagent" default:"$SDN_ENABLE_GUEST_MAN|true"`
|
||||
SdnEnableEipMan bool `help:"enable eip network manager in sdnagent" default:"$SDN_ENABLE_EIP_MAN|false"`
|
||||
|
||||
OvnSouthDatabase string `help:"address for accessing ovn south database" default:"$HOST_OVN_SOUTH_DATABASE|unix:/var/run/openvswitch/ovnsb_db.sock"`
|
||||
OvnEncapIp string `help:"encap ip for ovn datapath. Default to output src address of default route" default:"$HOST_OVN_ENCAP_IP"`
|
||||
OvnIntegrationBridge string `help:"name of integration bridge for logical ports" default:"$HOST_OVN_INTEGRATION_BRIDGE|brvpc"`
|
||||
OvnMappedBridge string `help:"name of bridge for mapped traffic management" default:"$HOST_OVN_MAPPED_BRIDGE|brmapped"`
|
||||
OvnEipBridge string `help:"name of bridge for eip traffic management" default:"$HOST_OVN_EIP_BRIDGE|breip"`
|
||||
OvnUnderlayMtu int `help:"mtu of ovn underlay network" default:"1500"`
|
||||
OvnSouthDatabase string `help:"address for accessing ovn south database" default:"$HOST_OVN_SOUTH_DATABASE|unix:/var/run/openvswitch/ovnsb_db.sock"`
|
||||
OvnEncapIpDetectionMethod string `help:"detection method for ovn_encap_ip" default:"$HOST_OVN_ENCAP_IP_DETECTION_METHOD"`
|
||||
OvnEncapIp string `help:"encap ip for ovn datapath. Default to src address of default route" default:"$HOST_OVN_ENCAP_IP"`
|
||||
OvnIntegrationBridge string `help:"name of integration bridge for logical ports" default:"$HOST_OVN_INTEGRATION_BRIDGE|brvpc"`
|
||||
OvnMappedBridge string `help:"name of bridge for mapped traffic management" default:"$HOST_OVN_MAPPED_BRIDGE|brmapped"`
|
||||
OvnEipBridge string `help:"name of bridge for eip traffic management" default:"$HOST_OVN_EIP_BRIDGE|breip"`
|
||||
OvnUnderlayMtu int `help:"mtu of ovn underlay network" default:"1500"`
|
||||
|
||||
EnableHealthChecker bool `help:"enable host health checker" default:"true"`
|
||||
HealthDriver string `help:"Component save host health state" default:"etcd"`
|
||||
|
||||
Reference in New Issue
Block a user