[Feature] Detect manually created multi-cluster EVPN fabrics and adopt them for ongoing management
Describe the feature
Discover EVPN controllers, zones, and vNets that already exist on more than one enrolled cluster, and let an operator adopt a matching span into PegaProx so the existing multi-cluster lifecycle (edit, drift scan, reconcile, add/remove member) applies to it from then on.
Cross-cluster EVPN shipped in 1.0 (#612) keeps its own authoritative record in multi_cluster_vnets. GET /api/multi-sdn/vnets only returns those rows, and the only writer is create_multi_vnet. A fabric built in the Proxmox UI, in PDM, or by hand before this feature existed never appears. Drift scan, reconcile, alias/subnet edit, and member add/remove all key off that table, so they cannot see it.
create_multi_vnet is idempotent when the live objects already match (_collisions_on_cluster allows an identical definition, and _apply_on_cluster skips objects that already exist). Re-typing the whole definition into the wizard is not a substitute for discovery:
- The operator has to already know every id, ASN, VNI, VRF-VXLAN, peer, and subnet. Nothing walks the clusters and proposes the span.
- Alias is not part of the collision check. A blank or guessed alias is stored as desired state. The drift scanner, and auto-reconcile when
multi_sdn_drift_reconcileis on, will then treat the live alias as drift and can overwrite it. vrf_vxlandefaults to the vNet VNI when omitted (#819 item 6). That default is wrong for a zone that already has its own L3 VNI.- A subnet included in the typed body that is not already on the vNet is created, and that path runs a cluster-wide SDN apply. A typo changes a production fabric.
- The shared definition does not snapshot fields that are real on a hand-built zone and that often differ per cluster: exit nodes, gateway MAC, MTU, and the controller peer list. Exit nodes are local to each cluster. A later reconcile that only knows the reduced definition can flatten them.
Suggested shape
1. Read-only discovery
Across enrolled clusters the caller can access, read controllers, zones, vNets, and subnets. No POST, PUT, DELETE, and no PUT /cluster/sdn.
Group candidates where all of these match on two or more clusters:
- EVPN controller: same id, type
evpn, same ASN - EVPN zone: same id, same controller, same VRF-VXLAN
- vNet: same id, same zone, same tag (VNI)
- subnet: same CIDR (and same gateway, when both sides have one)
One zone usually has several vNets. Each shared vNet is its own candidate span, shown grouped under the zone, matching the current multi_cluster_vnets model.
Also list, separately, and do not offer them as adoptable spans:
- The same vNet id with a different tag, zone, or VRF-VXLAN (conflict, not a span)
- A vNet that exists on only one cluster of an otherwise matching zone (local only)
- A matching zone that has no shared vNet yet (the fabric is there; nothing is stretched)
2. Preview before adopt
Per candidate, show the live object on each cluster side by side.
- Must match to adopt: controller id / type / ASN, zone id / VRF-VXLAN, vNet id / tag, subnet CIDR and gateway. Gateway MAC and vNet MTU should match for a stretched subnet; warn and refuse when they do not, rather than picking a winner.
- Expected to differ per cluster, and stored per member: exit nodes, and a peer list that is not identical. Do not collapse those into one value and push it everywhere.
- If two clusters disagree on a must-match field, show the mismatch and refuse adopt. The operator fixes it on the clusters, then scans again.
3. Adopt is a database write only
Confirming a candidate inserts a multi_cluster_vnets row. Desired state is the live snapshot, including alias, subnets (gateway and SNAT), and the per-member fields above. It does not create, edit, or apply anything on the clusters.
After that, the existing routes apply: edit, scan, reconcile, add member, remove member. Drift means "diverged from the adopted snapshot," not "diverged from a reduced template." Reconcile and auto-reconcile must not strip fields they do not model (exit nodes, gateway MAC, MTU) and must not treat a per-cluster difference that was accepted at adopt time as drift.
Delete already defaults to forgetting the row and leaving the SDN objects in place (?purge=1 tears them down). For an adopted span the UI should keep that default obvious, so "stop managing this" cannot be confused with "delete the fabric."
4. Keep discovering
Adoption is not a one-time import. A vNet added by hand later, on a zone PegaProx already knows, shows up as unmanaged until it is adopted. From a discovered zone, creating another vNet should open the existing wizard with controller, ASN, VRF-VXLAN, and peers filled in, so the next network is created by PegaProx on the fabric that is already there.
Use Case
Two production clusters already share one EVPN controller, one EVPN zone, and several vNets. That fabric was built in the Proxmox UI, with matching ASN, VRF-VXLAN, tags, and subnets, before it was managed from PegaProx. It works. Recreating it through the wizard would reload SDN on every node of every cluster for no change.
What is missing is the bookkeeping #612 added: one place to see the span, edit an alias or a subnet once, notice when a cluster drifts, and add a cluster later. Today that only exists for spans PegaProx created itself.
Alternatives considered
- Re-entering the create wizard with the live values and relying on the idempotent create path. It can land a row when every field is typed exactly, and it skips the SDN apply when nothing is missing. It does not find the fabric, it does not snapshot exit nodes or gateway MAC, and a wrong alias or an extra subnet either schedules a drift overwrite or changes the live fabric.
- Leaving the fabric in the Proxmox UI and editing each cluster by hand. That is what #612 replaced, but only for records PegaProx already holds.
- Deleting the live zone and recreating it from PegaProx. That is a cluster-wide SDN reload on a fabric that is already passing traffic.
How important is this for you?
Blocking my use case. The multi-cluster feature cannot see, watch, or edit a fabric it did not create, which is the one already in production.
Related: #612, #819, #1154
Checklist
- [x] I have searched existing issues and discussions to make sure this hasn't been requested before
- [x] I understand this is a wishlist and not a work order — volunteers decide what gets built, and when
- [x] I'm aware that "this should be easy, it's only a few lines" has never once turned out to be true 🪄
Thanks, that's a clear write-up. Splitting it into a read-only discovery and an adopt that only writes the record, with the per-cluster fields kept as they are, reads right to me. It reaches into how drift scan and reconcile treat fields they don't model today, so I've assigned it for a proper look. Noted, no timeline yet.
If PegaProx carries real work in your setup, a contribution on https://opencollective.com/pegaprox is what lets us take on bigger pieces like this one.