Skip to content

OPNET-595: machineconfiguration/v1alpha1: add BGPVIPConfig CRD - #2972

Draft
mkowalski wants to merge 1 commit into
openshift:masterfrom
mkowalski:bgpvipconfig-crd
Draft

OPNET-595: machineconfiguration/v1alpha1: add BGPVIPConfig CRD#2972
mkowalski wants to merge 1 commit into
openshift:masterfrom
mkowalski:bgpvipconfig-crd

Conversation

@mkowalski

@mkowalski mkowalski commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Typed, admission-validated configuration API for BGP-based VIP management (enhancement openshift/enhancements#1982), gated on BGPBasedVIPManagement (gate added in #2923). Replaces the Dev Preview bgp-vip-config ConfigMap and the serialized-JSON ControllerConfigSpec.BGPVIPPeersJSON user surface — the JSON field remains as MCO-internal transport, so templates and baremetal-runtimecfg are untouched.

Shape

bgpvipconfigs.machineconfiguration.openshift.io/v1alpha1, cluster-scoped singleton cluster:

  • localASN, defaultPeers (1–16, list-map by peerAddress), communities (≤8, format + segment-range CEL), hostOverrides (≤256, list-map by hostname, replaces — not merges — defaultPeers for the named node)
  • per-peer: peerAddress (isIP CEL), peerASN, passwordSecret (secret-only authentication — a name reference to a kubernetes.io/basic-auth Secret in openshift-config, password key, 80-byte TCP MD5 limit; no inline password field, and the shape mirrors frr-k8s's FRRConfiguration neighbor passwordSecret that CNO maps it onto), port, bfd/ebgpMultiHop (Enabled|Disabled enums), holdTimeSeconds/keepaliveTimeSeconds (0–65535, ≥3× relation CEL)
  • status: observedGeneration + conditions Rendered (MCO) and SessionsConfigured (CNO), written via SSA with distinct field managers
  • API/ingress VIPs are not duplicated here — consumers read them from the Infrastructure CR

Conventions applied per dev-guide/api-conventions.md: no booleans, no pointers for optional fields, integer-second durations (also BGP's wire-format uint16 seconds), no schema defaults (configuration API — consumers default, godoc documents omitted behavior), omitempty,omitzero struct reference per the Go 1.24 guidance.

Validation

Integration suite included (86 cases across the validation matrix incl. dual-stack peers, host overrides, timer relation, community segment range, passwordSecret name). The three consumers (installer render, MCO watch/serialize + NodeDisruptionPolicy, CNO FRRConfiguration render) are implemented and were validated end to end on a live dual-stack baremetal cluster against the previous revision of this API: byte-identical rendered peer configuration vs the ConfigMap path, day-2 peer edits propagating in ~45s with zero node disruption, and deletion of the Dev Preview ConfigMap with no effect. The consumers' passwordSecret rework follows this API; consumer PRs come once this merges (they currently vendor this branch).

Design doc with the full decision trail (Option A Infrastructure-spec placement vs this dedicated CRD): bgp-vip-demo spec


This PR description was generated using AI. Please verify before acting on it.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 10, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 10, 2026

Copy link
Copy Markdown

@mkowalski: This pull request references OPNET-595 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Typed, admission-validated configuration API for BGP-based VIP management (enhancement openshift/enhancements#1982), gated on BGPBasedVIPManagement (gate added in #2923). Replaces the Dev Preview bgp-vip-config ConfigMap and the serialized-JSON ControllerConfigSpec.BGPVIPPeersJSON user surface — the JSON field remains as MCO-internal transport, so templates and baremetal-runtimecfg are untouched.

Shape

bgpvipconfigs.machineconfiguration.openshift.io/v1alpha1, cluster-scoped singleton cluster:

  • localASN, defaultPeers (1–16, list-map by peerAddress), communities (≤8, format + segment-range CEL), hostOverrides (≤256, list-map by hostname, replaces — not merges — defaultPeers for the named node)
  • per-peer: peerAddress (isIP CEL), peerASN, inline password (deliberate: matches MetalLB's BGPPeer; a secret-reference variant is reserved as a future discriminated union), port, bfd/ebgpMultiHop (Enabled|Disabled enums), holdTimeSeconds/keepaliveTimeSeconds (0–65535, ≥3× relation CEL)
  • status: observedGeneration + conditions Rendered (MCO) and SessionsConfigured (CNO), written via SSA with distinct field managers
  • API/ingress VIPs are not duplicated here — consumers read them from the Infrastructure CR

Conventions applied per dev-guide/api-conventions.md: no booleans, no pointers for optional fields, integer-second durations (also BGP's wire-format uint16 seconds), no schema defaults (configuration API — consumers default, godoc documents omitted behavior).

Validation

Integration suite included (validation matrix incl. dual-stack peers, host overrides, timer relation, community segment range). The three consumers (installer render, MCO watch/serialize + NodeDisruptionPolicy, CNO FRRConfiguration render) are implemented and were validated end to end on a live dual-stack baremetal cluster: byte-identical rendered peer configuration vs the ConfigMap path, day-2 peer edits propagating in ~45s with zero node disruption, and deletion of the Dev Preview ConfigMap with no effect. Consumer PRs follow once this merges (they currently vendor this branch).

Draft notes

  • api-approved.openshift.io placeholder will be updated to this PR's URL in the next push
  • Design doc with the full decision trail (Option A Infrastructure-spec placement vs this dedicated CRD, and why the CRD won): bgp-vip-demo spec

This PR description was generated using AI. Please verify before acting on it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 10, 2026
@openshift-ci

openshift-ci Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Hello @mkowalski! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci openshift-ci Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: eff13c03-db3d-45ff-8124-55fae144d3b2

📥 Commits

Reviewing files that changed from the base of the PR and between 60218f9 and 22af5b1.

⛔ Files ignored due to path filters (5)
  • machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_bgpvipconfigs.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • machineconfiguration/v1alpha1/zz_generated.featuregated-crd-manifests/bgpvipconfigs.machineconfiguration.openshift.io/BGPBasedVIPManagement.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • machineconfiguration/v1alpha1/zz_generated.swagger_doc_generated.go is excluded by !**/zz_generated*
  • openapi/generated_openapi/zz_generated.openapi.go is excluded by !openapi/**, !**/zz_generated*
  • openapi/openapi.json is excluded by !openapi/**
📒 Files selected for processing (2)
  • machineconfiguration/v1alpha1/tests/bgpvipconfigs.machineconfiguration.openshift.io/BGPBasedVIPManagement.yaml
  • machineconfiguration/v1alpha1/types_bgpvipconfig.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • machineconfiguration/v1alpha1/tests/bgpvipconfigs.machineconfiguration.openshift.io/BGPBasedVIPManagement.yaml
  • machineconfiguration/v1alpha1/types_bgpvipconfig.go

📝 Walkthrough

Walkthrough

Added the BGPVIPConfig and BGPVIPConfigList API types. The API defines local ASN, default peers, host overrides, BFD, eBGP multihop, authentication, timers, communities, status, and conditions. Validation covers addresses, ASNs, ports, timers, list sizes, hostnames, and community values. The types are registered in v1alpha1. CRD tests cover valid configurations and validation errors.


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
No-Weak-Crypto ❌ Error BGPVIPPeer adds passwordSecret for TCP MD5 (RFC 2385), and the new tests accept this field; the pull request therefore adds weak-crypto support. Do not introduce TCP MD5 authentication. Use a modern authenticated transport or protocol, or isolate unavoidable legacy compatibility behind an explicit security exception.
Test Structure And Quality ⚠️ Warning The suite uses featureGate at line 4, but SuiteSpec accepts only featureGates; the loader ignores this field and treats the TechPreview tests as ungated. Change line 4 to featureGates: [BGPBasedVIPManagement] and verify the suite selects only the intended feature-gated CRD manifest.
✅ Passed checks (13 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the addition of the BGPVIPConfig CRD under the machineconfiguration/v1alpha1 API.
Description check ✅ Passed The description directly explains the BGPVIPConfig CRD, its validation, API shape, migration purpose, and testing coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed All 15 case titles and the suite title are fixed descriptive strings; dynamic test data such as IPs, worker-0, and secret names stays in YAML bodies, and the generator uses Entry(testEntry.Name).
Microshift Test Compatibility ✅ Passed The PR adds a YAML API integration fixture, not a MicroShift e2e test; the suite runs against envtest, and no Ginkgo e2e spec or MicroShift-incompatible assumption was added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The added test is a declarative CRD YAML suite, not a Ginkgo e2e test; it contains no It/Describe/Context/When cases or multi-node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The diff adds only BGPVIPConfig API types, CRD schemas, generated OpenAPI/deepcopy files, and validation tests; it adds no workloads, controllers, replicas, affinity, topology spread, selectors, to...
Ote Binary Stdout Contract ✅ Passed The PR changes only API, generated, and YAML files; scans found no process-level stdout/logging calls, and the existing suite routes logging to GinkgoWriter.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds YAML admission cases, not Ginkgo e2e tests; no It/Describe/Context/When code or external connectivity is present. IPv4 peer literals are validation fixtures, not network assumptions.
Container-Privileges ✅ Passed Changed content adds Go API types, CRD schemas, generated metadata, and validation tests; no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation settings were found.
No-Sensitive-Data-In-Logs ✅ Passed The commit adds no logging or print calls; password data is not represented, and fixtures contain only a non-sensitive Secret name plus test IPs and hostnames.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented
The command is terminated due to an error: build linters: unable to load custom analyzer "kubeapilinter": tools/_output/bin/kube-api-linter.so, plugin: not implemented


Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign joelspeed for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@machineconfiguration/v1alpha1/types_bgpvipconfig.go`:
- Around line 139-144: Replace the Password string field in BGPVIPConfig with a
Kubernetes Secret reference, preserving optional configuration semantics. Update
both consumers of BGPVIPConfig authentication data to resolve the referenced
Secret and use its password value, removing all direct reads of the serialized
Password field.
- Around line 56-65: Update the validation rule on the communities field in
BGPVIPConfig to enforce a maximum of 65535 for both segments of two-part classic
communities while retaining the 4294967295 limit for three-part communities. In
machineconfiguration/v1alpha1/tests/bgpvipconfigs.machineconfiguration.openshift.io/BGPBasedVIPManagement.yaml
lines 154-176, change the test to reject 64512:4294967295 and add a valid
three-part boundary case.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 8b0254dc-b4ee-4057-a786-5d1d7b1a1750

📥 Commits

Reviewing files that changed from the base of the PR and between 72ae442 and 997094c.

⛔ Files ignored due to path filters (8)
  • machineconfiguration/v1alpha1/zz_generated.crd-manifests/0000_80_machine-config_01_bgpvipconfigs.crd.yaml is excluded by !**/zz_generated.crd-manifests/*
  • machineconfiguration/v1alpha1/zz_generated.deepcopy.go is excluded by !**/zz_generated*
  • machineconfiguration/v1alpha1/zz_generated.featuregated-crd-manifests.yaml is excluded by !**/zz_generated*
  • machineconfiguration/v1alpha1/zz_generated.featuregated-crd-manifests/bgpvipconfigs.machineconfiguration.openshift.io/BGPBasedVIPManagement.yaml is excluded by !**/zz_generated.featuregated-crd-manifests/**
  • machineconfiguration/v1alpha1/zz_generated.model_name.go is excluded by !**/zz_generated*
  • machineconfiguration/v1alpha1/zz_generated.swagger_doc_generated.go is excluded by !**/zz_generated*
  • openapi/generated_openapi/zz_generated.openapi.go is excluded by !openapi/**, !**/zz_generated*
  • openapi/openapi.json is excluded by !openapi/**
📒 Files selected for processing (3)
  • machineconfiguration/v1alpha1/register.go
  • machineconfiguration/v1alpha1/tests/bgpvipconfigs.machineconfiguration.openshift.io/BGPBasedVIPManagement.yaml
  • machineconfiguration/v1alpha1/types_bgpvipconfig.go

Comment thread machineconfiguration/v1alpha1/types_bgpvipconfig.go Outdated
Comment thread machineconfiguration/v1alpha1/types_bgpvipconfig.go Outdated
mkowalski added a commit to mkowalski/bgp-vip-demo that referenced this pull request Aug 10, 2026
Assisted-By: Claude Fable 5
Signed-off-by: Mat Kowalski <mko@redhat.com>
Typed, admission-validated configuration API for BGP-based VIP
management (enhancement openshift/enhancements#1982, OPNET-595), gated
on BGPBasedVIPManagement: a cluster-scoped singleton carrying the local
ASN, the default BGP peer set, optional communities and per-host peer
overrides, replacing the Dev Preview bgp-vip-config ConfigMap and the
serialized-JSON ControllerConfigSpec.BGPVIPPeersJSON user surface (the
JSON field remains as machine-config-operator internal transport).

API conventions applied: Enabled/Disabled enums instead of booleans,
integer-second timer fields (BGP wire-format uint16 seconds), no schema
defaults (consumers default and godoc documents omitted behavior),
list-map peers/overrides, CEL validation for the singleton name, peer
IPs, timer relation and community segment ranges. Peer authentication is
secret-only: passwordSecret references a kubernetes.io/basic-auth Secret
in the openshift-config namespace ('password' key, 80-byte TCP MD5
limit) - passwords are never stored in this API; the shape mirrors
frr-k8s's FRRConfiguration neighbor passwordSecret, which the
cluster-network-operator maps it onto.

Status carries observedGeneration and two conditions: Rendered (owned by
machine-config-operator, set after the per-node peer configuration is
applied to the ControllerConfig) and SessionsConfigured (owned by
cluster-network-operator, set when the FRR session configuration has
been rendered for application).

Includes the integration test suite (validation matrix incl. dual-stack
peers, host overrides, timer relation, community range and
passwordSecret name validation). The consumers (installer, MCO, CNO)
are implemented against the inline-password revision and were validated
end to end on a live dual-stack baremetal cluster; their passwordSecret
rework follows this API.

Assisted-By: Claude Fable 5
Signed-off-by: Mat Kowalski <mko@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants