feat: update OpenAPI documentation and internal logic for BIRD settings. Enhance the description of BIRD parameters in openapi.yaml, adding details for optional BGP source addresses. Modify refresh.go to include handling for new BGP source address fields and update peer rendering logic accordingly. Improve user interface documentation in settings page to reflect changes in BIRD configuration options.
CI / changes (push) Successful in 6s
CI / openapi (push) Successful in 25s
CI / go (push) Successful in 22s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, , evobgp-web) (push) Successful in 1m1s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, evobgp-all, evobgp-web-all) (push) Successful in 1m0s
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Successful in 15s
CI / docker-go (deploy/docker/evobgp-agent/Dockerfile, , evobgp-agent) (push) Successful in 1m3s
CI / docker-go (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, , evobgp-all) (push) Successful in 1m26s
CI / docker-go (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, , evobgp-api) (push) Successful in 1m27s
CI / docker-go (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, , evobgp-deploy) (push) Successful in 1m22s
CI / docker-go (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, , evobgp-ingest) (push) Successful in 1m23s
CI / docker-go (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, , evobgp-node) (push) Successful in 1m13s
CI / docker-go (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, , evobgp-render) (push) Successful in 1m35s
CI / docker-go (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, , evobgp-scheduler) (push) Successful in 1m22s

This commit is contained in:
Denozordec
2026-04-06 11:35:36 +07:00
parent 431c6a90f1
commit 62bf987a19
3 changed files with 52 additions and 5 deletions
+22 -1
View File
@@ -700,7 +700,28 @@ components:
Settings:
type: object
description: KV настройки tenant/глобальные лимиты и feature flags.
description: |
KV настройки tenant/глобальные лимиты и feature flags.
Параметры BIRD (строки в `global_settings`, JSON-значения — обычно строка или число):
`bird_router_id`, `bird_local_ipv4`, `bird_local_ipv6`, `bird_local_asn`;
опционально `bird_bgp_source_ipv4` / `bird_bgp_source_ipv6` — явный адрес для директивы
`source address` у BGP-пиров (если не заданы, используется эффективный локальный адрес, как для `local` в шаблоне).
properties:
bird_router_id:
type: string
description: BIRD `router id` (рекомендуется IPv4 dotted quad).
bird_local_ipv4:
type: string
bird_local_ipv6:
type: string
bird_local_asn:
type: integer
bird_bgp_source_ipv4:
type: string
description: Исходящий IPv4 для `source address` в блоках `protocol bgp … from bgp_template`.
bird_bgp_source_ipv6:
type: string
description: Исходящий IPv6 для `source address` у пиров IPv6.
additionalProperties: true
RevisionDiff:
+25 -2
View File
@@ -333,6 +333,9 @@ type birdLocals struct {
localV4 string
localV6 string
localASN uint32
// Optional BGP TCP source (BIRD "source address"); empty => use effective local per peer.
sourceV4 string
sourceV6 string
}
func birdLocalsFromStore(st store.Backend, tenantID string) birdLocals {
@@ -359,9 +362,29 @@ func birdLocalsFromStore(st store.Backend, tenantID string) birdLocals {
if n := uint32FromSettingsMap(settings, "bird_local_asn"); n != 0 {
loc.localASN = n
}
if s := stringFromSettingsMap(settings, "bird_bgp_source_ipv4"); s != "" {
loc.sourceV4 = s
}
if s := stringFromSettingsMap(settings, "bird_bgp_source_ipv6"); s != "" {
loc.sourceV6 = s
}
return loc
}
func bgpPeerSourceIPv4(loc birdLocals, effectiveLocal string) string {
if s := strings.TrimSpace(loc.sourceV4); s != "" {
return s
}
return effectiveLocal
}
func bgpPeerSourceIPv6(loc birdLocals, effectiveLocal string) string {
if s := strings.TrimSpace(loc.sourceV6); s != "" {
return s
}
return effectiveLocal
}
func stringFromSettingsMap(m map[string]any, key string) string {
v, ok := m[key]
if !ok || v == nil {
@@ -455,7 +478,7 @@ func renderPeersBirdFragment(st store.Backend, tenantID string, loc birdLocals)
TemplateName: birdfmt.BGPTemplateNameV4,
NeighborIP: addr.String(),
NeighborASN: ra,
SourceAddress: lv4,
SourceAddress: bgpPeerSourceIPv4(loc, lv4),
}
if peerNeedsLocalOverride(loc, lv4, asn, true) {
opts.OverrideLocalIP = lv4
@@ -474,7 +497,7 @@ func renderPeersBirdFragment(st store.Backend, tenantID string, loc birdLocals)
TemplateName: birdfmt.BGPTemplateNameV6,
NeighborIP: addr.String(),
NeighborASN: ra,
SourceAddress: lv6,
SourceAddress: bgpPeerSourceIPv6(loc, lv6),
}
if peerNeedsLocalOverride(loc, lv6, asn, false) {
opts.OverrideLocalIP = lv6
+5 -2
View File
@@ -95,8 +95,11 @@
<CardHeader>
<CardTitle class="text-base">Настройки системы (API)</CardTitle>
<CardDescription>
<code class="text-xs">GET/PATCH /v1/settings</code> — глобальные параметры control plane.
Требуется роль operator.
<code class="text-xs">GET/PATCH /v1/settings</code> — глобальные параметры control plane (хранятся в БД).
Требуется роль operator. Для BIRD, например:
<code class="bg-muted rounded px-1 py-0.5 text-xs">bird_local_ipv4</code>,
<code class="bg-muted rounded px-1 py-0.5 text-xs">bird_bgp_source_ipv4</code> (опционально — только для строки
<code class="text-xs">source address</code> у BGP-пиров).
</CardDescription>
</CardHeader>
<CardContent class="space-y-4">