Skip to content

Commit

Permalink
Add ebgp-multihop function for kube-ovn-speaker (#1601)
Browse files Browse the repository at this point in the history
Co-authored-by: Edison Meng (孟志慧)-浪潮数据 <mengzhihui01@inspur.com>
  • Loading branch information
KillMaster9 and Edison Meng (孟志慧)-浪潮数据 committed Jun 12, 2022
1 parent 6dd2f0a commit b745379
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/speaker/config.go
Expand Up @@ -29,6 +29,7 @@ const (
DefaultPprofPort = 10667
DefaultGracefulRestartDeferralTime = 360 * time.Second
DefaultGracefulRestartTime = 90 * time.Second
DefaultEbgpMultiHop = 1
)

type Configuration struct {
Expand All @@ -46,6 +47,7 @@ type Configuration struct {
GracefulRestartDeferralTime time.Duration
GracefulRestartTime time.Duration
PassiveMode bool
EbgpMultihopTtl uint8

KubeConfigFile string
KubeClient kubernetes.Interface
Expand All @@ -71,6 +73,7 @@ func ParseFlags() (*Configuration, error) {
argPprofPort = pflag.Uint32("pprof-port", DefaultPprofPort, "The port to get profiling data, default: 10667")
argKubeConfigFile = pflag.String("kubeconfig", "", "Path to kubeconfig file with authorization and master location information. If not set use the inCluster token.")
argPassiveMode = pflag.BoolP("passivemode", "", false, "Set BGP Speaker to passive model,do not actively initiate connections to peers ")
argEbgpMultihopTtl = pflag.Uint8("ebgp-multihop", DefaultEbgpMultiHop, "The TTL value of EBGP peer, default: 1")
)
klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
klog.InitFlags(klogFlags)
Expand Down Expand Up @@ -111,6 +114,7 @@ func ParseFlags() (*Configuration, error) {
GracefulRestartDeferralTime: *argGracefulRestartDeferralTime,
GracefulRestartTime: *argDefaultGracefulTime,
PassiveMode: *argPassiveMode,
EbgpMultihopTtl: *argEbgpMultihopTtl,
}

if config.RouterId == "" {
Expand Down Expand Up @@ -213,6 +217,12 @@ func (config *Configuration) initBgpServer() error {
PassiveMode: config.PassiveMode,
},
}
if config.EbgpMultihopTtl != DefaultEbgpMultiHop {
peer.EbgpMultihop = &api.EbgpMultihop{
Enabled: true,
MultihopTtl: uint32(config.EbgpMultihopTtl),
}
}
if config.AuthPassword != "" {
peer.Conf.AuthPassword = config.AuthPassword
}
Expand Down

0 comments on commit b745379

Please sign in to comment.