Skip to content

Commit de3e218

Browse files
committed
feat(options): add flag for GoBGP grpc port
1 parent ef09bbd commit de3e218

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

docs/user-guide.md

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Usage of kube-router:
8686
--enable-pod-egress SNAT traffic from Pods to destinations outside the cluster. (default true)
8787
--enable-pprof Enables pprof for debugging performance and memory leak issues.
8888
--excluded-cidrs strings Excluded CIDRs are used to exclude IPVS rules from deletion.
89+
--gobgp-admin-port uint16 Port to connect to GoBGP for administrative purposes. (default 50051)
8990
--hairpin-mode Add iptables rules for every Service Endpoint to support hairpin traffic.
9091
--health-port uint16 Health check port, 0 = Disabled (default 20244)
9192
-h, --help Print usage information.

pkg/controllers/routing/network_routes_controller.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ type NetworkRoutingController struct {
122122
bgpServerStarted bool
123123
bgpHoldtime float64
124124
bgpPort uint32
125+
goBGPAdminPort uint16
125126
bgpRRClient bool
126127
bgpRRServer bool
127128
bgpClusterID string
@@ -1017,7 +1018,8 @@ func (nrc *NetworkRoutingController) startBgpServer(grpcServer bool) error {
10171018
if grpcServer {
10181019
nrc.bgpServer = gobgp.NewBgpServer(
10191020
gobgp.GrpcListenAddress(net.JoinHostPort(nrc.krNode.GetPrimaryNodeIP().String(),
1020-
"50051") + "," + "127.0.0.1:50051"))
1021+
strconv.FormatUint(uint64(nrc.goBGPAdminPort), 10)) + "," +
1022+
fmt.Sprintf("127.0.0.1:%d", nrc.goBGPAdminPort)))
10211023
} else {
10221024
nrc.bgpServer = gobgp.NewBgpServer()
10231025
}
@@ -1404,6 +1406,7 @@ func NewNetworkRoutingController(clientset kubernetes.Interface,
14041406
nrc.CNIFirewallSetup = sync.NewCond(&sync.Mutex{})
14051407

14061408
nrc.bgpPort = kubeRouterConfig.BGPPort
1409+
nrc.goBGPAdminPort = kubeRouterConfig.GoBGPAdminPort
14071410

14081411
// Convert ints to uint32s
14091412
peerASNs := make([]uint32, 0)

pkg/options/options.go

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const (
1313
DefaultBgpHoldTime = 90 * time.Second
1414
defaultHealthCheckPort = 20244
1515
defaultOverlayTunnelEncapPort uint16 = 5555
16+
defaultGoBGPAdminPort uint16 = 50051
1617
)
1718

1819
type KubeRouterConfig struct {
@@ -42,6 +43,7 @@ type KubeRouterConfig struct {
4243
ExternalIPCIDRs []string
4344
FullMeshMode bool
4445
GlobalHairpinMode bool
46+
GoBGPAdminPort uint16
4547
HealthPort uint16
4648
HelpRequested bool
4749
HostnameOverride string
@@ -164,6 +166,8 @@ func (s *KubeRouterConfig) AddFlags(fs *pflag.FlagSet) {
164166
"Excluded CIDRs are used to exclude IPVS rules from deletion.")
165167
fs.BoolVar(&s.GlobalHairpinMode, "hairpin-mode", false,
166168
"Add iptables rules for every Service Endpoint to support hairpin traffic.")
169+
fs.Uint16Var(&s.GoBGPAdminPort, "gobgp-admin-port", defaultGoBGPAdminPort,
170+
"Port to connect to GoBGP for administrative purposes.")
167171
fs.Uint16Var(&s.HealthPort, "health-port", defaultHealthCheckPort, "Health check port, 0 = Disabled")
168172
fs.BoolVarP(&s.HelpRequested, "help", "h", false,
169173
"Print usage information.")

0 commit comments

Comments
 (0)