Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cloud/etc/deploy-microovn/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ resource "juju_application" "openstack-network-agents-arm64" {
endpoint_bindings = var.openstack_network_agents_endpoint_bindings
}

resource "juju_integration" "amqp" {
# Sunbeam resolves the installed applications before configuring NDR.
# Keep this relation independent so a targeted apply preserves local charms.
for_each = var.ndr_rabbitmq_offer_url == null ? toset([]) : toset(var.ndr_applications)

model_uuid = data.juju_model.machine_model.uuid

application {
name = each.key
endpoint = "amqp"
}

application {
offer_url = var.ndr_rabbitmq_offer_url
}
}

resource "juju_application" "microcluster-token-distributor" {
name = "microcluster-token-distributor"
model_uuid = data.juju_model.machine_model.uuid
Expand Down
12 changes: 12 additions & 0 deletions cloud/etc/deploy-microovn/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,15 @@ variable "ca-offer-url" {
type = string
default = null
}

variable "ndr_rabbitmq_offer_url" {
description = "Control-plane RabbitMQ offer for Neutron dynamic routing agents"
type = string
default = null
}

variable "ndr_applications" {
description = "Network-agents applications with Neutron dynamic routing enabled"
type = list(string)
default = []
}
3 changes: 2 additions & 1 deletion sunbeam-python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ dependencies = [
"tenacity",
"jubilant>=1.3.0",
"packaging>=23.2",
"sunbeam-ndr-contract==2027.1.0.dev0",
]

[project.optional-dependencies]
Expand Down Expand Up @@ -127,7 +128,7 @@ install = "sunbeam.hooks:install"
post-refresh = "sunbeam.hooks:upgrade"

[tool.setuptools]
packages = ["sunbeam"]
packages = ["sunbeam", "sunbeam.features.dynamic_routing"]

[tool.setuptools.package-data]
sunbeam = ["features/*/etc/*/*.tf", "features/*/etc/*/modules/*/*.tf"]
Expand Down
19 changes: 19 additions & 0 deletions sunbeam-python/sunbeam/core/juju.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,25 @@ def run_action(
raise ActionFailedException(str(task))
return task.results

def get_application_endpoints(
self, applications: list[str], model: str
) -> dict[str, set[str]]:
"""Return declared endpoint names, including those with no relation."""
with self._model(model) as juju:
try:
details = self.cli(
"show-application",
*applications,
include_controller=False,
juju=juju,
)
except jubilant.CLIError as error:
raise JujuException(str(error)) from error
return {
name: set(info.get("endpoint-bindings", {}))
for name, info in details.items()
}

def get_application_actions(self, application: str, model: str) -> list[str]:
"""Return action names available for an application in a model."""
with self._model(model) as juju:
Expand Down
7 changes: 6 additions & 1 deletion sunbeam-python/sunbeam/core/openstack_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@


def get_admin_connection(
jhelper: JujuHelper, deployment: Deployment
jhelper: JujuHelper, deployment: Deployment, *, region_name: str | None = None
) -> "openstack.connection.Connection":
"""Return a connection to keystone using admin credentials.

:param jhelper: Juju helpers for retrieving admin credentials
:param region_name: Region to select from the service catalog
:raises: openstack.exceptions.SDKException
"""
admin_auth_info = retrieve_admin_credentials(jhelper, deployment, OPENSTACK_MODEL)
options: dict[str, typing.Any] = {}
if region_name is not None:
options["region_name"] = region_name
conn = openstack.connect(
auth_url=admin_auth_info.get("OS_AUTH_URL"),
username=admin_auth_info.get("OS_USERNAME"),
Expand All @@ -35,6 +39,7 @@ def get_admin_connection(
user_domain_name=admin_auth_info.get("OS_USER_DOMAIN_NAME"),
project_domain_name=admin_auth_info.get("OS_PROJECT_DOMAIN_NAME"),
cacert=admin_auth_info.get("OS_CACERT"),
**options,
)
return conn

Expand Down
102 changes: 102 additions & 0 deletions sunbeam-python/sunbeam/features/dynamic_routing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Neutron dynamic routing

The feature runs one idle DR agent per routing domain on each selected
MicroOVN network node. It requires NDR-enabled revisions
of the `neutron-k8s` and `openstack-network-agents` charms, the agent snap,
and a Neutron rock built from published NDR packages containing the
required route-event fixes. The nodes must already be joined to the
Sunbeam deployment and have the
`network` role. Neutron must use MicroOVN through the `sunbeam-ovn-proxy`
`ovsdb-cms` relation.

```yaml
features:
dynamic-routing:
config:
routing-domains:
red:
peering:
provider-trunk:
physnet: physnet1
vlan: 120
nodes:
net-01: {address: 192.0.2.3/28}
net-02: {address: 192.0.2.4/28}
blue:
address-families: [ipv6]
peering:
dedicated-uplink:
nodes:
net-01: {interface: enp5s0.122}
net-02: {interface: enp5s0.122}
```

Each domain accepts exactly one address family. Omitting `address-families`
selects IPv4. IPv4 and IPv6 domains can share the same network nodes.
Each attachment requires an explicit non-empty node map. For a provider
trunk, allow the specified VLAN on the fabric trunk and provide a static
CIDR for each node. For a dedicated uplink, provision the interface and
addressing before enablement. In Manual mode, give the interface name. In
MAAS, tag exactly one interface on each selected machine with
`ndr:<domain>` and omit the interface name. Specify a bare `address` when
the interface has more than one usable source in the chosen family.
Sunbeam validates the hosts and the Neutron schema before enabling NDR.

NDR is off by default. To opt in, run enable with your full deployment
manifest.

```bash
sunbeam enable --manifest deployment.yaml dynamic-routing
openstack bgp dragent list
```

Use each agent's unique host value, such as `net-01.red.v4`, to identify
its UUID. Set the fabric VRF and create and bind the peers and speaker
with `openstack bgp`. The NDR agent initiates the BGP connection. Configure
the fabric peer to accept connections to TCP port 179 from the agent's
peering address. For subnet-only export, use
`--no-advertise-floating-ip-host-routes`. An IPv4 speaker can export both
subnets and centralized floating IPs.

Reapply the manifest after changing placement or joining a candidate node.
Sunbeam reports bound agents before removal. Unbind them first, or use the
feature's `--force` option to stop the agents while retaining their Neutron
bindings. Re-adding an identity can reactivate an existing binding. Coordinate
placement updates with OpenStack operators so bindings do not change during the
removal check and apply. Manual and MAAS node removal require the node
to be drained from NDR placement first, even when removing with `--force`.
Drain the node while its charm unit is still available.

Run `sunbeam disable dynamic-routing` to stop all managed
instances and disable the plugin. The host watcher remains available to
process committed snap settings when NDR is enabled again.

To change a domain's family or an agent's peering attachment or address,
unbind and remove the affected placement first. Reapply the manifest to
drain it, then add the new placement and bind the agents. An empty
`routing-domains: {}` map drains the last domain. Omitting the entire map
reuses saved placement.

Drain legacy prototype domains explicitly after refreshing the charm and
snap. The old flat `nodes` schema cannot select host attachments. Bind any
replacement agent that registers under a new UUID.

If a saved provider-trunk attachment can no longer be resolved, for example
because its physnet mapping disappeared, the snap stops the NDR agents on
that unit and retains the existing firewall protection. Restore the mapping
so the watcher can validate the placement and resume the agents.

Sunbeam assigns router IDs from `router-id-pool`, which defaults to
`198.18.0.0/15`, and retains its reservations across drain and re-enable
with the same pool. Omit the option to keep the saved pool. Disable NDR
before switching pools.

Sunbeam retrieves admin credentials from the deployment's Keystone and
uses the deployment's region to select the Neutron endpoint. IPv4 and
IPv6 each need their own Neutron BGP speaker and agent binding. IPv6 uses
a numbered IPv6 peer and next hop in the qualified topology. The BGP
router ID remains a 32-bit identifier.
The first rollout uses plain RabbitMQ transport. Release qualification includes
route freshness during RPC loss and forwarding through the selected fabric VRFs.
On IPv6 fabrics with multicast snooping, verify neighbor resolution after
cache expiry as part of release qualification.
4 changes: 4 additions & 0 deletions sunbeam-python/sunbeam/features/dynamic_routing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2026 - Canonical Ltd
# SPDX-License-Identifier: Apache-2.0

"""Neutron dynamic routing feature."""
Loading
Loading