Skip to content

Topology: YAML topology files and ordered gateway tiers#679

Open
thiell wants to merge 4 commits into
clustershell:masterfrom
thiell:feature/gh374-topology-yaml
Open

Topology: YAML topology files and ordered gateway tiers#679
thiell wants to merge 4 commits into
clustershell:masterfrom
thiell:feature/gh374-topology-yaml

Conversation

@thiell

@thiell thiell commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Implements the design discussed in #374 (see the design comment). Closes #374.

YAML topology files

  • New topology.yaml file syntax: routes as a list of gateways/targets objects. Selected by file extension (.yaml/.yml), so --topology works with both syntaxes; INI topology.conf remains fully supported.
  • Unlike INI, the same gateways may appear in several routes: one gateway pool can reach several target groups, with symmetric failback — the core need from the PR Tree: support optional route weights in topology.conf (#374) #678 review.
  • topology.yaml is preferred over topology.conf when both exist at the same config location.
  • TopologyParser becomes a thin facade over per-format backends; graph building and validation are unchanged and format-agnostic. The INI code path is untouched and still covered by the existing tests.
  • PyYAML is imported lazily, only when a YAML topology is loaded (same pattern as YAML group files). Reviewer question (HLD §8): keep it optional like this, or make PyYAML a hard dependency? Note install_requires already pulls PyYAML for pip installs, so this mostly matters for distro packages.

Ordered gateway tiers

  • In YAML, the gateways of a route may be a list of entries with descriptive attributes, in the style of modern YAML tools such as lnetctl: nodes (node set, required), weight (load share within a tier, default 1) and tier (failover rank, default 1). A tier is used only when all gateways in lower tiers are unreachable:
routes:
  - gateways:
      - nodes: gw1
      - nodes: gw2
        tier: 2             # gw1 default, gw2 failover
    targets:  rio[100-199]
  - gateways:
      - nodes: gw2
      - nodes: gw1
        tier: 2             # gw2 default, gw1 failover
    targets:  rio[200-299]
  • A plain list of node sets (gateways: [gw1, gw2]) is a load-shared pool, equivalent to gateways: gw[1-2] — failover is always explicit with tier, and the entry form keeps the schema extensible for future per-gateway attributes.
  • Within a tier, load is shared with least-connections as today, weighted by weight (integers >= 1). Weight 0 is rejected: a standby gateway is a higher tier, so there is only one mechanism.
  • Tiers apply to all traffic routed through the pool, including targets deeper in the tree.
  • Resolved tiers ride the pickled TopologyTree; trees from older versions are still accepted, and the wire protocol is unchanged.

Docs and tests

  • config.rst/clush.rst document the YAML syntax, quoting rules (@group values must be quoted), precedence and tiers; conf/topology.yaml.example added.
  • New tests/TreeRouterTest.py covers gateway selection: tier order, failover, mutual failback, weighted distribution, pool equivalence of plain lists, multi-level trees, pickled-tree round-trip, pre-1.11 tree compatibility. YAML parser tests added to TreeTopologyTest, including INI/YAML tree equivalence.

Supersedes PR #678 (now a draft): the INI [weights] section is not kept, and its weighted least-connections selection is reused as the within-tier policy.

thiell added 2 commits July 18, 2026 08:39
Turn TopologyParser into a thin facade over an internal ConfigParser
and an intermediate route list, so that a second configuration format
can be added. No behavior change.

Signed-off-by: Stephane Thiell <stephane@thiell.com>
Add a YAML topology file syntax, selected by .yaml/.yml file
extension. Routes are a list of gateways/targets objects and the
same gateways may appear in several routes. topology.yaml is
preferred over topology.conf at each config location. INI stays
fully supported. PyYAML is imported lazily, as for YAML group files.

Signed-off-by: Stephane Thiell <stephane@thiell.com>
@thiell thiell added this to the 1.11 milestone Jul 18, 2026
@thiell
thiell requested review from degremont and kcgthb July 19, 2026 00:00
thiell added 2 commits July 19, 2026 08:17
In a YAML topology file, the gateways of a route may be a list of
entries with nodes, weight and tier attributes. A tier is used only
when all gateways in lower tiers are unreachable. Within a tier, the
load is shared using weighted least-connections. Resolved tiers ride
the propagation tree sent to gateways; older trees without tiers are
still accepted.

Signed-off-by: Stephane Thiell <stephane@thiell.com>
Document the topology.yaml syntax, ordered gateway tiers and
discovery precedence in config.rst and clush.rst. INI topology.conf
remains documented as fully supported.

Signed-off-by: Stephane Thiell <stephane@thiell.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway: add hop/weight parameter to routes

1 participant