Skip to content

add BGP peer timer and BFD configuration support to BGPPolicy CRD#7844

Open
Denyme24 wants to merge 3 commits intoantrea-io:mainfrom
Denyme24:feat/bgp-timers-bfd-configuration
Open

add BGP peer timer and BFD configuration support to BGPPolicy CRD#7844
Denyme24 wants to merge 3 commits intoantrea-io:mainfrom
Denyme24:feat/bgp-timers-bfd-configuration

Conversation

@Denyme24
Copy link
Contributor

fixes #7673

Summary

this PR adds support for configuring BGP peer timers (keepalive and hold time) and introduces BFD (Bidirectional Forwarding Detection) configuration fields in the BGPPolicy CRD. These options allow more control over BGP session behavior and prepare the API for fast failure detection once GoBGP supports BFD.

Changes

API Definition (pkg/apis/crd/v1alpha1/types.go)

  • added KeepaliveTimeSeconds (int32, 1–65535) to configure the BGP KEEPALIVE interval
  • added HoldTimeSeconds (int32, 0 or 3–65535) to configure the BGP hold timeout (0 disables it)
  • added BFDConfig struct with Enabled, MinTransmitInterval, MinReceiveInterval, and Multiplier
  • added BFD pointer field to the BGPPeer struct

CRD Schema (build/charts/antrea/crds/bgppolicy.yaml)

  • added OpenAPI v3 validation for the new timer fields with appropriate ranges
  • added schema validation for the BFD configuration fields

GoBGP Mapping (pkg/agent/bgp/gobgp/gobgp.go)

  • implemented timer conversion in convertPeerConfigToGoBGPPeer()
  • maps Antrea timer values to GoBGP TimersConfig protobuf fields
  • added a note that BFD mapping will be implemented once GoBGP exposes the required API

Deep Copy (pkg/apis/crd/v1alpha1/zz_generated.deepcopy.go)

  • added deep copy handling for KeepaliveTimeSeconds, HoldTimeSeconds, and BFD in BGPPeer
  • implemented BFDConfig.DeepCopyInto() and BFDConfig.DeepCopy()

Tests

pkg/agent/bgp/gobgp/gobgp_test.go

  • added assertions for nil timer fields
  • added TestConvertPeerConfigToGoBGPPeerTimers with multiple subtests covering different timer combinations

pkg/agent/controller/bgp/controller_test.go

  • added generateBGPPeerWithTimers() helper
  • added TestBGPPolicyWithTimers integration test covering Add and Update scenarios

Test Results

  • all existing tests pass
  • all new tests pass (GoBGP unit tests and controller integration tests)
  • no breaking changes introduced

…omponents

Signed-off-by: Denyme24 <namanraj24@outlook.com>
Copilot AI review requested due to automatic review settings March 12, 2026 22:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the BGPPolicy CRD to support per-peer BGP timers (KEEPALIVE / Hold Time) and introduces a bfd configuration block in the API, with initial GoBGP timer mapping and accompanying tests/docs.

Changes:

  • Add keepaliveTimeSeconds, holdTimeSeconds, and bfd fields to the BGPPeer API types (plus deepcopy support).
  • Extend the bgppolicy CRD OpenAPI schema and user documentation to describe / validate the new fields.
  • Map timer values into GoBGP TimersConfig in the agent and add unit/integration test coverage for timer handling.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pkg/apis/crd/v1alpha1/types.go Adds BGPPeer timer fields and introduces BFDConfig / bfd API.
pkg/apis/crd/v1alpha1/zz_generated.deepcopy.go Adds deepcopy support for the new BGPPeer fields and BFDConfig.
build/charts/antrea/crds/bgppolicy.yaml Updates the CRD schema to include timer and BFD fields.
pkg/agent/bgp/gobgp/gobgp.go Maps the new timer fields into GoBGP peer configuration.
pkg/agent/bgp/gobgp/gobgp_test.go Adds unit tests for timer-to-GoBGP conversion behavior.
pkg/agent/controller/bgp/controller_test.go Adds integration-style test coverage for timer propagation through the controller.
docs/bgp-policy.md Documents the new timer and BFD fields for users.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…BGPPolicy CRD; update related documentation and tests

Signed-off-by: Denyme24 <namanraj24@outlook.com>
Signed-off-by: Denyme24 <namanraj24@outlook.com>
@Denyme24
Copy link
Contributor Author

hey @antoninbas @petertran-avgo @luolanzone, would appreciate a review whenever you have a moment. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BGP Timer and BFD Support

2 participants