diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..ecbf645 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,20 @@ +name: docs + +on: + pull_request: + paths: + - docs/** + - "*.md" + - .github/workflows/docs.yml + schedule: + - cron: "41 5 * * 1" + workflow_dispatch: + +permissions: + contents: read + +jobs: + docs: + uses: phorge-fr/.github/.github/workflows/docs-lint.yml@main + with: + external-links: ${{ github.event_name != 'pull_request' }} diff --git a/AGENTS.md b/AGENTS.md index 011f053..9949955 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,7 +4,7 @@ Instructions for anyone working in this repository, human or AI assistant. The o ## What this repository is -The OpenTofu configuration and bootstrap scripts of the edge router (a MikroTik running RouterOS 7). It owns VLANs, addressing, DHCP, DNS records, the firewall, NAT, and the container that runs HAProxy to publish services. Start with [docs/architecture.md](docs/architecture.md); the rebuild procedure is [docs/runbook-reset.md](docs/runbook-reset.md). +The OpenTofu configuration and bootstrap scripts of the edge router (a MikroTik running RouterOS 7). It owns VLANs, addressing, DHCP, DNS records, the firewall, NAT, and the container that runs HAProxy to publish services. Start with [docs/explanation/architecture.md](docs/explanation/architecture.md) and [docs/reference/network-plan.md](docs/reference/network-plan.md); the rebuild procedure is [docs/how-to/reset-and-bootstrap-the-router.md](docs/how-to/reset-and-bootstrap-the-router.md). Three layers, each with an owner ([decision 0001](docs/decisions/0001-three-configuration-layers.md)): @@ -35,7 +35,7 @@ When a finding concerns a system-level setting, the answer is "this goes in `bas - `prevent_destroy` guards the bridge, its ports, the VLANs and the IP addresses. The firewall order is managed with `routeros_move_items` and must match the live order. - HAProxy routes are edited in `templates/haproxy.cfg.tftpl`; `tofu apply` pushes the file and the container reloads by itself ([decision 0002](docs/decisions/0002-haproxy-hot-reload.md)). Do not re-add a Terraform data model for routes. Changing a container attribute restarts it; do not change `entrypoint` or `cmd` of the production container in place. - A new public host name needs a route in the HAProxy template (SNI and HTTP redirect): the edge does not forward unknown hosts to the right cluster. -- `api-ssl` of the router and the monitoring user's password are partly manual, see `phorge-fr/Hangar` `docs/runbooks/router-monitoring.md`. +- `api-ssl` of the router and the monitoring user's password are partly manual, see `phorge-fr/Hangar` `docs/how-to/fix-an-empty-router-dashboard.md`. ## Security reports diff --git a/README.md b/README.md index 27bcbfb..d4110c7 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ OpenTofu configuration and bootstrap scripts of the edge router of the [Phorge]( Documentation: -- [Architecture and network plan](docs/architecture.md): topology, VLANs and addresses, wiring, hosts and clusters, public services, traffic flows, change checklists. -- [Reset and bootstrap runbook](docs/runbook-reset.md): rebuild the router from scratch and bring it back under OpenTofu. +- [Documentation index](docs/README.md): how-to guides, the network plan, the architecture and the decision records. +- [Reset and bootstrap the router](docs/how-to/reset-and-bootstrap-the-router.md): rebuild the router from scratch and bring it back under OpenTofu. Sibling repositories: [FrontPlane](https://github.com/phorge-fr/Frontplane) (Kubernetes clusters), [Ansible](https://github.com/phorge-fr/Ansible) (storage, HPC and compute nodes). @@ -32,7 +32,7 @@ terraform.tfvars Values: networks, DNS records, firewall, NAT, containers templates/ HAProxy configuration template and the script that reloads it certs/ Local trust anchor: the router CA (ignored by git, see the runbook) defaults/ RouterOS scripts: factory defaults, base configuration, Phorge.dpk -docs/ Architecture and runbooks +docs/ Documentation by type: how-to, reference, explanation, decisions ``` One entry in `networks` (name, VLAN ID, CIDR, optionally a DHCP pool, node ranges and the host number of the public ingress) creates the VLAN, the router address (the last usable address of the subnet), the DHCP pool, network and server, the membership of the `phorge` interface list and the `-nodes` address list. The ingress addresses also feed the HAProxy configuration and the rules that let the container reach them, so they exist in one place. @@ -56,7 +56,7 @@ One entry in `networks` (name, VLAN ID, CIDR, optionally a DHCP pool, node range The passwords of the extra RouterOS users declared in `users` go in `TF_VAR_user_passwords`, a JSON object keyed by user name (at least 24 random characters each). They never go in `terraform.tfvars`. A service that reads one of them keeps its own copy: the `mktxp` password is also stored SOPS-encrypted in the Frontplane repository. - The provider verifies the router certificate against `certs/router-ca.pem`, a local file that is not committed. Fetch it as described in [the runbook](docs/runbook-reset.md#6-bring-the-router-back-under-opentofu). The first run after a router reset can use `TF_VAR_insecure_tls=true` instead. + The provider verifies the router certificate against `certs/router-ca.pem`, a local file that is not committed. Fetch it as described in [the reset how-to](docs/how-to/reset-and-bootstrap-the-router.md#6-bring-the-router-back-under-opentofu). The first run after a router reset can use `TF_VAR_insecure_tls=true` instead. 2. Initialize: @@ -74,7 +74,7 @@ One entry in `networks` (name, VLAN ID, CIDR, optionally a DHCP pool, node range Run every command from the repository root so that `terraform.tfvars` is loaded. Without it the plan stops on missing required variables. -The HAProxy configuration is `templates/haproxy.cfg.tftpl`. Edit it and run `tofu apply`: the container reloads it by itself within about 15 seconds, without dropping connections (see [the runbook](docs/runbook-reset.md#haproxy-configuration-reload), including how to check that HAProxy accepted it). Do not edit the file on the router, the next apply would overwrite it. +The HAProxy configuration is `templates/haproxy.cfg.tftpl`. Edit it and run `tofu apply`: the container reloads it by itself within about 15 seconds, without dropping connections (see [the reset how-to](docs/how-to/reload-the-haproxy-configuration.md), including how to check that HAProxy accepted it). Do not edit the file on the router, the next apply would overwrite it. The uploaded HAProxy configuration is adopted automatically (`import` block in `containers.tf`) because RouterOS file IDs shift when other files change. @@ -83,14 +83,14 @@ The VLANs, IP addresses, bridges and bridge ports have `prevent_destroy`: a plan ## Conventions - Every object created by OpenTofu carries a comment starting with `tofu;;;`. -- Firewall rules have a stable `id` and are placed on the router in list order by `routeros_move_items`. A rule with `before` sits right above the factory rule of that name in the same chain, the others go to the end of the chain. See [the runbook](docs/runbook-reset.md#firewall-rule-order). +- Firewall rules have a stable `id` and are placed on the router in list order by `routeros_move_items`. A rule with `before` sits right above the factory rule of that name in the same chain, the others go to the end of the chain. See [the reset how-to](docs/how-to/reset-and-bootstrap-the-router.md#firewall-rule-order). - The state is local (`terraform.tfstate`, ignored by git) and encrypted with OpenTofu's native state encryption. Every command needs `source .env`, otherwise it stops with `Reference to undeclared key provider`. Keep a copy of the state after every apply. - All three Phorge repositories are public. Never commit `.env`, the state (not even encrypted), a reset-edited `base_configuration.rsc` or any other plaintext secret. - Commit messages follow Conventional Commits (`fix(fw): ...`, `chore(haproxy): ...`). ## Setting up the router for the first time -Follow [the runbook](docs/runbook-reset.md). In short: replace the placeholders in `defaults/base_configuration.rsc`, reset the router with the factory defaults, upload `defaults/Phorge.dpk`, import the base configuration, then run OpenTofu. +Follow [the reset how-to](docs/how-to/reset-and-bootstrap-the-router.md). In short: replace the placeholders in `defaults/base_configuration.rsc`, reset the router with the factory defaults, upload `defaults/Phorge.dpk`, import the base configuration, then run OpenTofu. ## Contributing diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..8e316dc --- /dev/null +++ b/docs/README.md @@ -0,0 +1,34 @@ +# Network documentation + +Pages are grouped by what the reader wants, following [the organization's documentation standard](https://github.com/phorge-fr/.github/blob/main/docs/reference/documentation-standard.md). + +## How-to guides + +| Page | Task | +| --- | --- | +| [Reset and bootstrap the router](how-to/reset-and-bootstrap-the-router.md) | Rebuild the router from scratch and bring it back under OpenTofu | +| [Reload the HAProxy configuration](how-to/reload-the-haproxy-configuration.md) | Change a public route | +| [Change the network](how-to/change-the-network.md) | Add a VLAN, a flow or a public hostname | +| [Remove factory rules from the state](how-to/remove-factory-rules-from-the-state.md) | Clear a plan that wants to delete the factory firewall rules | + +## Reference + +| Page | Content | +| --- | --- | +| [Network plan](reference/network-plan.md) | Addresses, VLANs, wiring, hosts, public services and traffic flows | + +## Explanation + +| Page | Question it answers | +| --- | --- | +| [Architecture](explanation/architecture.md) | How the infrastructure and the repositories fit together | +| [Known inconsistencies](explanation/known-inconsistencies.md) | Where files and the live router disagreed | + +## Decisions + +| Record | Status | +| --- | --- | +| [0001 Three configuration layers](decisions/0001-three-configuration-layers.md) | accepted | +| [0002 Keep HAProxy, routes in a template, hot reload](decisions/0002-haproxy-hot-reload.md) | accepted | +| [0003 State and certificates are never committed](decisions/0003-state-and-certificates-not-committed.md) | accepted | +| [0004 Containers reach only what the rules allow](decisions/0004-container-network-containment.md) | accepted | diff --git a/docs/decisions/0001-three-configuration-layers.md b/docs/decisions/0001-three-configuration-layers.md index 425c61f..409df49 100644 --- a/docs/decisions/0001-three-configuration-layers.md +++ b/docs/decisions/0001-three-configuration-layers.md @@ -1,17 +1,50 @@ -# 0001: Three configuration layers +--- +status: accepted +date: 2026-09-20 +decision-makers: l-nmch +--- -Status: accepted. +# Three configuration layers: factory, bootstrap script, OpenTofu -## Decision +## Context and problem statement -- `defaults/default_configuration.rsc` is the MikroTik factory configuration. Never edit it. -- `defaults/base_configuration.rsc` is the maintainer's own script that pre-provisions the router after a reset: DNS servers, hardening, certificates, services, Ethernet port MTU/L2MTU, which ports are disabled, the management LAN and base users. -- OpenTofu owns the network objects: VLANs, addresses, DHCP, DNS records, firewall, NAT, containers, HAProxy configuration. +The router was reset and rebuilt by hand once. Drift between the bootstrap script, the live router and the code caused an L2 MTU incident. Where does each kind of setting live? -## Why +## Decision drivers -The bootstrap must stay a plain RouterOS script under the maintainer's control. The router was once reset and rebuilt by hand, and drift between the bootstrap script, the live router and the code caused an L2 MTU incident. An experiment that managed Ethernet ports and the DNS settings in OpenTofu was stopped. All ports use the same large MTU (VLAN MTU depends on the bridge, which depends on the physical ports). The placeholders in the bootstrap script stay as they are (no templating). +* The bootstrap must stay a plain RouterOS script under the maintainer's control. +* OpenTofu should own only network objects, and only what it can also delete. -## Consequences +## Considered options -System-level settings never move into OpenTofu. A setting that OpenTofu cannot delete (the router API services) is set by hand and documented in the runbook. +* Three layers: factory configuration, the maintainer's bootstrap script, OpenTofu for the rest. +* OpenTofu for everything, including Ethernet ports and DNS settings. + +## Decision outcome + +Chosen option: "three layers". + +* `defaults/default_configuration.rsc` is the MikroTik factory configuration. Never edit it. +* `defaults/base_configuration.rsc` is the maintainer's script that pre-provisions the router after a reset: DNS servers, hardening, certificates, services, Ethernet port MTU and L2MTU, which ports are disabled, the management LAN and base users. +* OpenTofu owns VLANs, addresses, DHCP, DNS records, the firewall, NAT, containers and the HAProxy configuration. + +### Consequences + +* Good, because a reset is a script plus `tofu apply`. +* Bad, because a system setting that OpenTofu cannot delete (the router API services) is set by hand and documented in the [reset how-to](../how-to/reset-and-bootstrap-the-router.md). + +## Pros and cons of the options + +### Three layers + +* Good, because each layer has one owner. +* Bad, because one must know which layer a setting belongs to. + +### OpenTofu for everything + +* Good, because one tool. +* Bad, because an experiment that managed Ethernet ports and DNS in OpenTofu was stopped: the maintainer wants the bootstrap to be theirs, and all ports use the same large MTU (the VLAN MTU depends on the bridge, which depends on the ports). + +## More information + +The placeholders in the bootstrap script stay as they are (no templating). diff --git a/docs/decisions/0002-haproxy-hot-reload.md b/docs/decisions/0002-haproxy-hot-reload.md index 42d1422..94be8ab 100644 --- a/docs/decisions/0002-haproxy-hot-reload.md +++ b/docs/decisions/0002-haproxy-hot-reload.md @@ -1,18 +1,58 @@ -# 0002: Keep HAProxy, routes in a template, hot reload +--- +status: accepted +date: 2026-09-21 +decision-makers: l-nmch +--- -Status: accepted, live. +# Keep HAProxy, routes in a template, hot reload -## Context +## Context and problem statement -The router runs HAProxy in a container to publish services by SNI and HTTP host. Options considered: a Kubernetes ingress (rejected: the platform's ingress does not route outside its cluster, and the official Traefik image has no 32-bit ARM build for this router), or an HAProxy Terraform provider (none can express SNI-based backend switching or the needed request rules). +The router runs HAProxy in a container to publish services by SNI and HTTP host. How are the routes edited, and how does a change reach HAProxy without an outage? -## Decision +## Decision drivers -Keep HAProxy. The routing rules are edited in `templates/haproxy.cfg.tftpl`; `tofu apply` renders and pushes the file and a wrapper script (`templates/haproxy-run.sh`) reloads HAProxy in place. The wrapper runs a private copy of the configuration published atomically, refuses an invalid file (the old configuration keeps running) and keeps the last good copy for restarts. +* Reload without restarting the container. +* Routes editable by hand in the repository. +* No component that cannot run on this 32-bit ARM router. -## Lessons +## Considered options -- Changing `entrypoint` or `cmd` of the production container in place once left it started but silent and unresponsive; only recreating it from its original definition recovered it. Validate wrapper changes on isolated throwaway containers first, then apply targeted. -- A syntactically valid but wrong configuration is not caught. `tofu apply` succeeds even when HAProxy refuses the file, so check the router log after an apply. -- A container attribute change still restarts the container (a few seconds). -- Rate limiting is out of scope until the client address HAProxy sees is the real one. +* Keep HAProxy, edit `templates/haproxy.cfg.tftpl`, reload in place. +* A Kubernetes ingress as the edge. +* An HAProxy Terraform provider or its Data Plane API. + +## Decision outcome + +Chosen option: "keep HAProxy with a template and an in-place reload". `tofu apply` renders and pushes the file; a wrapper script (`templates/haproxy-run.sh`) reloads HAProxy. The wrapper runs a private copy of the configuration published atomically, refuses an invalid file (the old configuration keeps running) and keeps the last good copy for restarts. + +### Consequences + +* Good, because adding a route is one edit and one apply. +* Bad, because a valid but wrong configuration is loaded as is, and `tofu apply` succeeds even when HAProxy refuses the file: read the router log after an apply ([how-to](../how-to/reload-the-haproxy-configuration.md)). +* Bad, because a change to a container attribute still restarts it (a few seconds), and rate limiting is out of scope until the client address HAProxy sees is the real one. + +### Confirmation + +The router log shows `haproxy.cfg changed: reloading` followed by `Loading success`. + +## Pros and cons of the options + +### HAProxy with a template + +* Good, because it works today. +* Bad, because routes are text, not data. + +### A Kubernetes ingress + +* Good, because it reuses a cluster tool. +* Bad, because a cluster ingress does not route outside its cluster (Hangar decision 0005), and the official Traefik image has no 32-bit ARM build. + +### An HAProxy provider or Data Plane API + +* Good, because it models the routes as resources. +* Bad, because no provider can express SNI-based backend switching. + +## More information + +Changing `entrypoint` or `cmd` of the production container in place once left it started but silent and unresponsive; only recreating it from its original definition recovered it. Validate wrapper changes on isolated throwaway containers first, then apply targeted. A data model for routes was written and then removed on purpose: do not add one back. diff --git a/docs/decisions/0003-state-and-certificates-not-committed.md b/docs/decisions/0003-state-and-certificates-not-committed.md index 9ef8098..e29efaa 100644 --- a/docs/decisions/0003-state-and-certificates-not-committed.md +++ b/docs/decisions/0003-state-and-certificates-not-committed.md @@ -1,5 +1,37 @@ -# 0003: State and certificates are never committed +--- +status: accepted +date: 2026-09-20 +decision-makers: l-nmch +--- -Status: accepted. +# State and certificates are never committed -The repository is public with permanent history, the state has no locking and changes constantly. So: the state is not committed, not even encrypted; `certs/` (the router CA used to verify its HTTPS certificate) is gitignored and fetched with the runbook; the provider lock file is committed. State encryption is nevertheless on, with its passphrase only in the gitignored `.env`, which the maintainer keeps in a password manager. +## Context and problem statement + +The repository is public with permanent history. The OpenTofu state has no locking and changes constantly, and the provider verifies the router certificate against a local CA file. What may be committed? + +## Considered options + +* Commit neither the state nor the CA file; encrypt the state locally. +* Commit the state encrypted. + +## Decision outcome + +Chosen option: "commit neither". The state is not committed, even encrypted; `certs/` is gitignored and fetched with [the reset how-to](../how-to/reset-and-bootstrap-the-router.md); the provider lock file is committed. State encryption stays on, with its passphrase only in the gitignored `.env`, which the maintainer keeps in a password manager. + +### Consequences + +* Good, because nothing recoverable sits in the permanent history. +* Bad, because the state lives on one machine; losing it means re-importing. + +## Pros and cons of the options + +### Commit neither + +* Good, because no secret in history. +* Bad, because a single copy of the state. + +### Commit the state encrypted + +* Good, because a backup in Git. +* Bad, because permanent history, churn and no locking. diff --git a/docs/decisions/0004-container-network-containment.md b/docs/decisions/0004-container-network-containment.md index 5d75769..3c89155 100644 --- a/docs/decisions/0004-container-network-containment.md +++ b/docs/decisions/0004-container-network-containment.md @@ -1,5 +1,45 @@ -# 0004: Containers reach only what the rules allow +--- +status: accepted +date: 2026-09-21 +decision-makers: l-nmch +--- -Status: accepted, applied. +# Containers reach only what the rules allow -A process in a RouterOS container runs with all capabilities and the version in use offers no way to drop them, so the network is the containment. The forward chain drops traffic from the containers bridge that is not explicitly allowed, and an anti-spoof rule drops packets whose source is not one of the containers' own addresses (the address list is derived from the `veths` variable). The accept rules for HAProxy are bound to that address list. The detailed analysis is kept in the private report, not here. +## Context and problem statement + +A process in a RouterOS container runs with all capabilities, and the RouterOS version in use offers no way to drop them. If a container were compromised, what could it reach? + +## Considered options + +* Contain the containers at the network: forward drop from the containers bridge unless allowed, plus anti-spoofing. +* Rely on the container user and image alone. + +## Decision outcome + +Chosen option: "contain at the network". The forward chain drops traffic from the containers bridge that is not explicitly allowed, and an anti-spoof rule drops packets whose source is not one of the containers' own addresses (the address list is derived from the `veths` variable). The accept rules for HAProxy are bound to that address list. + +### Consequences + +* Good, because a compromised container reaches only its allowed destinations. +* Bad, because every new container flow needs an explicit rule. + +### Confirmation + +The `ctr-spoof` and `ctr-drop` log counters stay at zero in normal operation (`/ip firewall filter print stats where log-prefix~"ctr-"`). + +## Pros and cons of the options + +### Contain at the network + +* Good, because it does not depend on the container. +* Bad, because more rules to maintain. + +### Rely on the container + +* Good, because simple. +* Bad, because root in the container has every capability. + +## More information + +The detailed analysis is kept in the private report, not here. diff --git a/docs/decisions/README.md b/docs/decisions/README.md deleted file mode 100644 index ead37fa..0000000 --- a/docs/decisions/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Decision records - -| # | Decision | Status | -| --- | --- | --- | -| [0001](0001-three-configuration-layers.md) | Three configuration layers: factory, bootstrap script, OpenTofu | Accepted | -| [0002](0002-haproxy-hot-reload.md) | Keep HAProxy, routes in a template, hot reload | Accepted | -| [0003](0003-state-and-certificates-not-committed.md) | State and certificates are never committed | Accepted | -| [0004](0004-container-network-containment.md) | Containers reach only what the rules allow | Accepted | diff --git a/docs/explanation/architecture.md b/docs/explanation/architecture.md new file mode 100644 index 0000000..4479399 --- /dev/null +++ b/docs/explanation/architecture.md @@ -0,0 +1,63 @@ +--- +type: explanation +audience: contributor who needs the shape of the infrastructure and how the repositories relate +verified: 2026-10-27 +--- + +# Phorge infrastructure architecture + +How the Phorge infrastructure fits together and how this repository relates to the other two. Written from the live router (RouterOS 7.19, observed on 2026-09-20), the OpenTofu configuration, and the [FrontPlane](https://github.com/phorge-fr/Frontplane) and [Ansible](https://github.com/phorge-fr/Ansible) repositories. When a fact changes, fix it here in the same change. + +The facts (addresses, VLANs, hosts, flows) are in [the network plan](../reference/network-plan.md). + +## Repositories + +| Repository | Owns | Tooling | +|---|---|---| +| **Network** (this one) | The edge router: VLANs, addressing, DHCP, DNS, firewall, NAT, and the HAProxy container that publishes services | OpenTofu, RouterOS scripts | +| **FrontPlane** | The three k0s Kubernetes clusters `control`, `core` and `svc` and everything that runs in them | FluxCD, SOPS + age, k0sctl, Cilium | +| **Ansible** | Everything that is not Kubernetes: the storage node, the HPC nodes, the Incus compute nodes, SSH hardening and the host firewalls | Ansible, Vault | + +A flow between two VLANs has to be allowed in up to three places: the router (`firewall_rules` in [terraform.tfvars](../../terraform.tfvars)), the host firewall (`firewall_allowed_ports` in the Ansible inventory) and, for pod traffic, a NetworkPolicy in FrontPlane. See the [checklists](../how-to/change-the-network.md). + +## Topology + +```mermaid +flowchart TB + net(["Internet"]) + isp["ISP box
192.168.1.1"] + subgraph router["RB3011 edge router - RouterOS 7.19"] + wan["ether1 WAN
192.168.1.103"] + ha["HAProxy container
172.17.0.2"] + gw["bridge + VLAN interfaces
gateway x.0.254"] + end + net --> isp + isp -->|"TCP 80/443"| wan + wan -->|"dst-nat 8080/8443"| ha + ha --> gw + gw ---|"ether2"| swa["switch: ctrl, core, comp, ai hosts"] + gw ---|"ether5"| swb["switch main-sw-1: stor, svc hosts"] + gw ---|"ether3"| adm["admin workstation"] +``` + +- The router is the only gateway. `ether1` is a DHCP client of the ISP box. The ISP box forwards TCP 80 and 443 to the router, which dst-NATs them to a HAProxy container running on the router itself (bridge `containers`, 172.17.0.0/24). +- The `bridge` carries the management LAN untagged (192.168.2.0/24) and the workload VLANs 20 to 80 as tagged sub-interfaces. VLAN filtering is off: every bridge port carries every VLAN, and isolation between VLANs is done by routing and the firewall on the router only. +- The VLAN interfaces use MTU 8152, so the bridge and every physical port under it need an L2MTU of at least 8156 (the bridge L2MTU is the lowest of its ports). [base_configuration.rsc](../../defaults/base_configuration.rsc) sets `l2mtu=8156` and `mtu=8156` on every Ethernet port. +- The RB3011 has two switch chips (`ether1` to `ether5` on `switch1`, `ether6` to `ether10` on `switch2`). Traffic between the two groups is bridged by the CPU. + +## DNS, TLS and secrets + +**DNS.** The router is the resolver of every VLAN (DHCP hands out `x.0.254`). It forwards to 1.1.1.1 and to the ISP box learned by DHCP. Static records for the nodes (`*.phorge`) and the three `*.core.phorge` aliases live in `dns_records`. Public `phorge.fr` names are on Cloudflare. + +**TLS.** + +- Public hostnames: Let's Encrypt through cert-manager (`public-issuer`, DNS-01 with a Cloudflare token) on `traefik-public`. +- Internal hostnames: `local-root-ca`, a self-signed ECDSA CA issued by cert-manager (10 years) that signs `*.core.phorge`. Its certificate is copied to the storage node as `alloy_ca_cert`. +- The router has its own CA (`Phorge-Core-0`, RSA 2048, valid to 2036) that signs the certificate of its HTTPS service (`router-https`, with `IP:192.168.2.254`, `core0.phorge` and `main-gw-0.phorge` as subject alternative names), which is the REST API OpenTofu talks to. The provider verifies it against `certs/router-ca.pem`, a local file that is not committed. + +**Secrets.** FrontPlane uses SOPS with age. Ansible uses Vault (inline `!vault` values, whole-file encryption for `.env` files). This repository keeps RouterOS credentials in `.env` (ignored) and the state in a local file (ignored) that OpenTofu encrypts with a passphrase kept in `.env`. All three GitHub repositories are public: commit ciphertext only, never plaintext. + +## Related + +- [Known inconsistencies](known-inconsistencies.md) +- [Change the network](../how-to/change-the-network.md) diff --git a/docs/explanation/known-inconsistencies.md b/docs/explanation/known-inconsistencies.md new file mode 100644 index 0000000..e6547cc --- /dev/null +++ b/docs/explanation/known-inconsistencies.md @@ -0,0 +1,17 @@ +--- +type: explanation +audience: maintainer deciding what to clean up in the network configuration +verified: 2026-10-27 +--- + +# Known inconsistencies + +Things that disagree between files, or between a file and the live router, as observed on 2026-09-20. Check an item before relying on it: some may be fixed since. + +1. DHCP pools span `.1` to `.253` of every cluster VLAN, so they overlap the nodes (`.1`-`.3`), the API virtual IP (`.4`) and the Cilium pool (`.10`-`.20`). +2. The `nfs-uncritical` StorageClass on `control` and `core` points to NFS server 10.6.0.1. No 10.6.0.0/24 network exists on the router. +3. HAProxy targets 10.1.0.11 that the firewall does not allow (about 406,000 packets dropped by `Drop Containers to phorge` in the 3 days before 2026-09-20, most of them towards 10.10.0.1-3:8443 until `Allow Hproxy to Incus cluster API` was added). +4. The GPU host is `ai-z440-01` in the inventory, holds a DHCP lease (10.5.0.4) under the hostname `hpc1`, has no DNS record, and is outside `ai-nodes` (10.5.0.1-2). The HPC monitoring config scrapes `hpc0.phorge`. +5. The FrontPlane README bootstraps Flux from a repository called `Hangar`. +6. The three clusters share the pod and service CIDRs (10.244.0.0/16, 10.96.0.0/12), which rules out a future cluster mesh or direct pod routing between them. +7. `base_configuration.rsc` disables `ether10`, the intended switch uplink. diff --git a/docs/how-to/change-the-network.md b/docs/how-to/change-the-network.md new file mode 100644 index 0000000..15bdc5d --- /dev/null +++ b/docs/how-to/change-the-network.md @@ -0,0 +1,35 @@ +--- +type: how-to +audience: maintainer adding a VLAN, a flow or a public hostname +verified: 2026-10-27 +--- + +# Change the network + +Checklists for the three common changes. Each one touches more than one repository. + +## Add a VLAN or a cluster + +1. Network: one entry in `networks` (the VLAN, the router address, the DHCP pool and server, the `phorge` interface list membership and the `-nodes` address list are derived), plus `dns_records`. +2. Ansible: inventory group, `firewall_allowed_ports` and `firewall_trusted_sources` in its `group_vars`. +3. FrontPlane: `clusters//setup/` (k0s config, `ip-pools.yml`, the interface name in `l2announcementpolicy.yml`) and the Traefik patches in `overlays//controllers/traefik/`. +4. If it is published: `ingress = 11` on its entry in `networks`, `templates/haproxy.cfg.tftpl`, then a router rule towards its ingress with `dst_ingress`. +5. Update this document. + +## Add a flow between two VLANs + +1. Router: a rule in `firewall_rules` with a unique `id`, `before = "defconf: drop invalid"` (forward accepts) and `in_interface` set. +2. Host: `firewall_allowed_ports` (or `firewall_published_ports` for Docker) in Ansible. +3. Pods: a NetworkPolicy or CiliumNetworkPolicy in FrontPlane if the destination is a pod. +4. After applying, check that the rule counts packets: `/ip firewall filter print stats`. + +## Add a public hostname + +1. DNS record at Cloudflare. +2. FrontPlane: an Ingress with class `traefik-public` and `cert-manager.io/cluster-issuer: public-issuer`. +3. `templates/haproxy.cfg.tftpl`: the host in the HTTP redirect ACLs and a `use_backend` line on the SNI frontend. After `tofu apply` the container reloads by itself. +4. A router rule from `containers` to that cluster's ingress, if it is a new cluster. + +## Related + +- [The network plan](../reference/network-plan.md) diff --git a/docs/how-to/reload-the-haproxy-configuration.md b/docs/how-to/reload-the-haproxy-configuration.md new file mode 100644 index 0000000..e833b24 --- /dev/null +++ b/docs/how-to/reload-the-haproxy-configuration.md @@ -0,0 +1,45 @@ +--- +type: how-to +audience: maintainer changing a public route or the HAProxy container +verified: 2026-09-26 +--- + +# Reload the HAProxy configuration + +The container runs `templates/haproxy-run.sh`, uploaded to `usb1/haproxy-etc/run.sh`. It starts HAProxy in master-worker mode and compares the checksum of `haproxy.cfg` every 5 seconds. When the file changes, it validates it with `haproxy -c` and, if it is valid, asks HAProxy to reload gracefully: existing connections finish on the old process, new ones use the new configuration, and the container does not restart. An invalid file is refused and the running configuration stays. Measured on the router, a change is live 5 to 15 seconds after `tofu apply`, because the check itself takes a few seconds on this CPU. + +To add a public hostname, add its two lines (the redirect in `http-dispatcher` and the `use_backend` in `sni-dispatcher`) to `templates/haproxy.cfg.tftpl` and run `tofu apply`. The file in the repository is the source of truth: do not edit it on the router, because the next apply overwrites it and the container reloads the old version. `tofu apply` succeeds even when HAProxy refuses the file, because it only uploads it, so check that the router took the change into account: + +```bash +ssh user@192.168.2.254 '/log print where message~"haproxy"' +``` + +`haproxy.cfg changed: reloading` followed by `Loading success` means it is live. `haproxy.cfg changed but is invalid` means the running configuration did not change, and the next lines give the reason. + +The check only catches configurations that HAProxy cannot parse. A valid configuration that is wrong, such as a mistyped address or a removed route, is loaded as it is: fix the template and apply again. + +If the container restarts while the file is invalid, for example after a reboot of the router, the script keeps running the last configuration that passed the check and logs it (`haproxy.cfg is invalid, keeping the last good configuration`). The file on the router is left as it was uploaded, so `tofu plan` shows no difference: the log is the only place where the refusal appears. + +The old HAProxy process stays until its connections end (`timeout tunnel` is 6 hours), so several reloads in a row leave several processes running for a while. A change to `run.sh` itself only takes effect at the next container restart. + +Changing an attribute of the container itself (image, user, entrypoint, mounts) recreates or restarts it: about a minute without service when the image changes, because the container is recreated, and about 10 seconds for a restart. + +## Privileges + +The container user is `0:0`, and HAProxy still runs as uid 99 (`haproxy`) with no capability and with `no_new_privs`. RouterOS creates every directory without the execute bit (`drw-r--r--`), and it offers no way to change that (`/file` has no permission argument, and neither has the provider), so an unprivileged container user cannot read the mounted directory. `run.sh` therefore stays root, reads `haproxy.cfg`, checks a copy as uid 99 and hands HAProxy that copy in `/etc/haproxy-run`, a directory owned by root that HAProxy can read but not write. The script refuses to start if `setpriv` is missing rather than run HAProxy as root. + +Check it in the log after a start: + +```bash +ssh user@192.168.2.254 '/log print where message~"haproxy-run"' +``` + +`haproxy-run: haproxy Uid: 99 99 99 99 CapEff: 0000000000000000 NoNewPrivs: 1` is the expected line. Anything else means HAProxy is not unprivileged. + +## The image + +The image is pinned by digest in `terraform.tfvars` (`arm32v7/haproxy@sha256:...`, HAProxy 3.4.4). RouterOS honours the digest and the provider reads it back without a difference. To upgrade, look up the digest of the new tag (`https://hub.docker.com/v2/repositories/arm32v7/haproxy/tags/`, field `digest`), put it in `terraform.tfvars` and apply: the container is recreated. RouterOS 7.19 has no `check-certificate` option for the registry, so the digest is the only integrity check on the pull. A container can hold at most `maxconn` 4096 connections, about 8,300 open files. + +## Related + +- [Decision: keep HAProxy and reload it in place](../decisions/0002-haproxy-hot-reload.md) diff --git a/docs/how-to/remove-factory-rules-from-the-state.md b/docs/how-to/remove-factory-rules-from-the-state.md new file mode 100644 index 0000000..aba53f3 --- /dev/null +++ b/docs/how-to/remove-factory-rules-from-the-state.md @@ -0,0 +1,16 @@ +--- +type: how-to +audience: maintainer whose plan proposes to delete the factory firewall rules +verified: 2026-09-26 +--- + +# Remove factory rules from the state + +The factory (defconf) firewall rules are not declared in `terraform.tfvars`. If an earlier session imported them into the state, a plan proposes to delete them from the router. Remove the state entries instead of applying: + +```bash +tofu state list | grep defconf +tofu state rm '
' +``` + +The `special dummy rule to show fasttrack counters` entries are dynamic and are never managed. diff --git a/docs/runbook-reset.md b/docs/how-to/reset-and-bootstrap-the-router.md similarity index 60% rename from docs/runbook-reset.md rename to docs/how-to/reset-and-bootstrap-the-router.md index f8e030b..420abeb 100644 --- a/docs/runbook-reset.md +++ b/docs/how-to/reset-and-bootstrap-the-router.md @@ -1,4 +1,10 @@ -# Runbook: reset and bootstrap the router +--- +type: how-to +audience: maintainer rebuilding the router from scratch +verified: 2026-09-26 +--- + +# Reset and bootstrap the router Use it when the router has to be rebuilt from scratch: factory reset, replacement hardware, or a configuration that is beyond repair. The router is the only gateway of the infrastructure, so every step below takes the whole network down until the VLANs and the firewall are back. @@ -31,7 +37,7 @@ Edit `defaults/base_configuration.rsc` and replace the placeholders. Do not comm ssh admin@192.168.88.1 /system/reset-configuration ``` -Keep the factory defaults (do not pass `no-defaults`): [default_configuration.rsc](../defaults/default_configuration.rsc) is what makes the router reachable on 192.168.88.1 afterwards. +Keep the factory defaults (do not pass `no-defaults`): [default_configuration.rsc](../../defaults/default_configuration.rsc) is what makes the router reachable on 192.168.88.1 afterwards. ## 3. Upload the DPK and reboot @@ -127,49 +133,7 @@ The addresses are the `core-nodes`. The `api-ssl-from-core` firewall rule and th 5. From outside, `https://status.phorge.fr` answers. 6. The container rules stay quiet: `/ip firewall filter print stats where log-prefix~"ctr-"` shows 0 packets for `ctr-spoof` and `ctr-drop`. A hit means a container tried something the firewall does not allow, and `/log print where message~"ctr-"` shows what. -## HAProxy configuration reload - -The container runs `templates/haproxy-run.sh`, uploaded to `usb1/haproxy-etc/run.sh`. It starts HAProxy in master-worker mode and compares the checksum of `haproxy.cfg` every 5 seconds. When the file changes, it validates it with `haproxy -c` and, if it is valid, asks HAProxy to reload gracefully: existing connections finish on the old process, new ones use the new configuration, and the container does not restart. An invalid file is refused and the running configuration stays. Measured on the router, a change is live 5 to 15 seconds after `tofu apply`, because the check itself takes a few seconds on this CPU. - -To add a public hostname, add its two lines (the redirect in `http-dispatcher` and the `use_backend` in `sni-dispatcher`) to `templates/haproxy.cfg.tftpl` and run `tofu apply`. The file in the repository is the source of truth: do not edit it on the router, because the next apply overwrites it and the container reloads the old version. `tofu apply` succeeds even when HAProxy refuses the file, because it only uploads it, so check that the router took the change into account: - -```bash -ssh user@192.168.2.254 '/log print where message~"haproxy"' -``` - -`haproxy.cfg changed: reloading` followed by `Loading success` means it is live. `haproxy.cfg changed but is invalid` means the running configuration did not change, and the next lines give the reason. - -The check only catches configurations that HAProxy cannot parse. A valid configuration that is wrong, such as a mistyped address or a removed route, is loaded as it is: fix the template and apply again. - -If the container restarts while the file is invalid, for example after a reboot of the router, the script keeps running the last configuration that passed the check and logs it (`haproxy.cfg is invalid, keeping the last good configuration`). The file on the router is left as it was uploaded, so `tofu plan` shows no difference: the log is the only place where the refusal appears. - -The old HAProxy process stays until its connections end (`timeout tunnel` is 6 hours), so several reloads in a row leave several processes running for a while. A change to `run.sh` itself only takes effect at the next container restart. - -Changing an attribute of the container itself (image, user, entrypoint, mounts) recreates or restarts it: about a minute without service when the image changes, because the container is recreated, and about 10 seconds for a restart. - -### Privileges - -The container user is `0:0`, and HAProxy still runs as uid 99 (`haproxy`) with no capability and with `no_new_privs`. RouterOS creates every directory without the execute bit (`drw-r--r--`), and it offers no way to change that (`/file` has no permission argument, and neither has the provider), so an unprivileged container user cannot read the mounted directory. `run.sh` therefore stays root, reads `haproxy.cfg`, checks a copy as uid 99 and hands HAProxy that copy in `/etc/haproxy-run`, a directory owned by root that HAProxy can read but not write. The script refuses to start if `setpriv` is missing rather than run HAProxy as root. - -Check it in the log after a start: - -```bash -ssh user@192.168.2.254 '/log print where message~"haproxy-run"' -``` - -`haproxy-run: haproxy Uid: 99 99 99 99 CapEff: 0000000000000000 NoNewPrivs: 1` is the expected line. Anything else means HAProxy is not unprivileged. - -### The image - -The image is pinned by digest in `terraform.tfvars` (`arm32v7/haproxy@sha256:...`, HAProxy 3.4.4). RouterOS honours the digest and the provider reads it back without a difference. To upgrade, look up the digest of the new tag (`https://hub.docker.com/v2/repositories/arm32v7/haproxy/tags/`, field `digest`), put it in `terraform.tfvars` and apply: the container is recreated. RouterOS 7.19 has no `check-certificate` option for the registry, so the digest is the only integrity check on the pull. A container can hold at most `maxconn` 4096 connections, about 8,300 open files. - -## Factory rules in the state - -The factory (defconf) firewall rules are not declared in `terraform.tfvars`. If an earlier session imported them into the state, a plan proposes to delete them from the router. Remove the state entries instead of applying: - -```bash -tofu state list | grep defconf -tofu state rm '
' -``` +## Related -The `special dummy rule to show fasttrack counters` entries are dynamic and are never managed. +- [Reload the HAProxy configuration](reload-the-haproxy-configuration.md) +- [Remove factory rules from the state](remove-factory-rules-from-the-state.md) diff --git a/docs/architecture.md b/docs/reference/network-plan.md similarity index 55% rename from docs/architecture.md rename to docs/reference/network-plan.md index 8ce2d02..d4f9984 100644 --- a/docs/architecture.md +++ b/docs/reference/network-plan.md @@ -1,53 +1,12 @@ -# Phorge infrastructure: architecture and network plan +--- +type: reference +audience: anyone who looks up an address, a VLAN, a host or a flow +verified: 2026-10-27 +--- -How the Phorge infrastructure fits together and how this repository relates to the other two. Written from the live router (RouterOS 7.19, observed on 2026-09-20), the OpenTofu configuration, and the [FrontPlane](https://github.com/phorge-fr/Frontplane) and [Ansible](https://github.com/phorge-fr/Ansible) repositories. When a fact changes, fix it here in the same change. +# Network plan -- [Repositories](#repositories) -- [Topology](#topology) -- [Network plan](#network-plan) -- [Physical wiring](#physical-wiring) -- [Hosts and clusters](#hosts-and-clusters) -- [Services and public hostnames](#services-and-public-hostnames) -- [Traffic flows](#traffic-flows) -- [DNS, TLS and secrets](#dns-tls-and-secrets) -- [Roadmap](#roadmap) -- [Known inconsistencies](#known-inconsistencies) -- [Change checklists](#change-checklists) - -## Repositories - -| Repository | Owns | Tooling | -|---|---|---| -| **Network** (this one) | The edge router: VLANs, addressing, DHCP, DNS, firewall, NAT, and the HAProxy container that publishes services | OpenTofu, RouterOS scripts | -| **FrontPlane** | The three k0s Kubernetes clusters `control`, `core` and `svc` and everything that runs in them | FluxCD, SOPS + age, k0sctl, Cilium | -| **Ansible** | Everything that is not Kubernetes: the storage node, the HPC nodes, the Incus compute nodes, SSH hardening and the host firewalls | Ansible, Vault | - -A flow between two VLANs has to be allowed in up to three places: the router (`firewall_rules` in [terraform.tfvars](../terraform.tfvars)), the host firewall (`firewall_allowed_ports` in the Ansible inventory) and, for pod traffic, a NetworkPolicy in FrontPlane. See the [checklists](#change-checklists). - -## Topology - -```mermaid -flowchart TB - net(["Internet"]) - isp["ISP box
192.168.1.1"] - subgraph router["RB3011 edge router - RouterOS 7.19"] - wan["ether1 WAN
192.168.1.103"] - ha["HAProxy container
172.17.0.2"] - gw["bridge + VLAN interfaces
gateway x.0.254"] - end - net --> isp - isp -->|"TCP 80/443"| wan - wan -->|"dst-nat 8080/8443"| ha - ha --> gw - gw ---|"ether2"| swa["switch: ctrl, core, comp, ai hosts"] - gw ---|"ether5"| swb["switch main-sw-1: stor, svc hosts"] - gw ---|"ether3"| adm["admin workstation"] -``` - -- The router is the only gateway. `ether1` is a DHCP client of the ISP box. The ISP box forwards TCP 80 and 443 to the router, which dst-NATs them to a HAProxy container running on the router itself (bridge `containers`, 172.17.0.0/24). -- The `bridge` carries the management LAN untagged (192.168.2.0/24) and the workload VLANs 20 to 80 as tagged sub-interfaces. VLAN filtering is off: every bridge port carries every VLAN, and isolation between VLANs is done by routing and the firewall on the router only. -- The VLAN interfaces use MTU 8152, so the bridge and every physical port under it need an L2MTU of at least 8156 (the bridge L2MTU is the lowest of its ports). [base_configuration.rsc](../defaults/base_configuration.rsc) sets `l2mtu=8156` and `mtu=8156` on every Ethernet port. -- The RB3011 has two switch chips (`ether1` to `ether5` on `switch1`, `ether6` to `ether10` on `switch2`). Traffic between the two groups is bridged by the CPU. +Observed on the live router (RouterOS 7.19) and in the OpenTofu configuration. [How it fits together](../explanation/architecture.md). ## Network plan @@ -140,7 +99,7 @@ The storage node exports `/mnt/main/csi-svc` over NFSv4 to the three svc nodes a Forgejo also serves Git over SSH on 10.3.0.13:22, internal only. -HAProxy ([templates/haproxy.cfg.tftpl](../templates/haproxy.cfg.tftpl)) routes plain HTTP on 8080 (redirect to HTTPS for the seven known hosts, everything else to the control ingress) and TLS on 8443 by SNI without terminating it: `iaas` to the Incus nodes, `api` to the control ingress, `auth`, `monitoring`, `status` and `cap` to the core ingress, `git` to the svc ingress, anything else to the control ingress. A change to the file is picked up by the running container without a restart. HAProxy runs as uid 99 with no capability although the container user is `0:0`, and the image is pinned by digest (see the runbook). The ingress addresses and the Incus node addresses are not typed in the template: they come from `networks` (`ingress` and `nodes`), and the rules that let the container reach the ingresses use the same data. +HAProxy ([templates/haproxy.cfg.tftpl](../../templates/haproxy.cfg.tftpl)) routes plain HTTP on 8080 (redirect to HTTPS for the seven known hosts, everything else to the control ingress) and TLS on 8443 by SNI without terminating it: `iaas` to the Incus nodes, `api` to the control ingress, `auth`, `monitoring`, `status` and `cap` to the core ingress, `git` to the svc ingress, anything else to the control ingress. A change to the file is picked up by the running container without a restart. HAProxy runs as uid 99 with no capability although the container user is `0:0`, and the image is pinned by digest (see the runbook). The ingress addresses and the Incus node addresses are not typed in the template: they come from `networks` (`ingress` and `nodes`), and the rules that let the container reach the ingresses use the same data. Client addresses reach the ingresses through the PROXY protocol v2. HAProxy traffic is masqueraded by the router (NAT rule for 172.17.0.0/24), so each Traefik trusts PROXY headers only from the router address of its VLAN (`x.0.254/32`, set in `overlays/*/controllers/traefik/traefik-public-patch.yml`). Changing that NAT rule, the HAProxy source or the Traefik `trustedIPs` breaks client address preservation. @@ -200,62 +159,3 @@ Dotted arrows are flows that the architecture asks for but the firewall does not | Incus nodes to core `traefik-local` (Loki logs and events, OpenFGA authorization; Alloy metrics and logs) | TCP 443 | `incus-comp-to-core` | allowed | | Incus nodes to the router (BGP) | TCP 179 | `bgp-from-comp` (input chain) | allowed | | Control cluster to the LLM gateway (LiteLLM, TCP 4000) on the HPC node | TCP 4000 | none | implied by the control cluster role and the `hpc-servers` role, which is not wired yet | - -## DNS, TLS and secrets - -**DNS.** The router is the resolver of every VLAN (DHCP hands out `x.0.254`). It forwards to 1.1.1.1 and to the ISP box learned by DHCP. Static records for the nodes (`*.phorge`) and the three `*.core.phorge` aliases live in `dns_records`. Public `phorge.fr` names are on Cloudflare. - -**TLS.** - -- Public hostnames: Let's Encrypt through cert-manager (`public-issuer`, DNS-01 with a Cloudflare token) on `traefik-public`. -- Internal hostnames: `local-root-ca`, a self-signed ECDSA CA issued by cert-manager (10 years) that signs `*.core.phorge`. Its certificate is copied to the storage node as `alloy_ca_cert`. -- The router has its own CA (`Phorge-Core-0`, RSA 2048, valid to 2036) that signs the certificate of its HTTPS service (`router-https`, with `IP:192.168.2.254`, `core0.phorge` and `main-gw-0.phorge` as subject alternative names), which is the REST API OpenTofu talks to. The provider verifies it against `certs/router-ca.pem`, a local file that is not committed. - -**Secrets.** FrontPlane uses SOPS with age. Ansible uses Vault (inline `!vault` values, whole-file encryption for `.env` files). This repository keeps RouterOS credentials in `.env` (ignored) and the state in a local file (ignored) that OpenTofu encrypts with a passphrase kept in `.env`. All three GitHub repositories are public: commit ciphertext only, never plaintext. - -## Roadmap - -Planned work that is visible in the repositories: - -- **IaaS** on the Incus cluster: deployed (OVN networking, Ceph storage, OIDC through Authentik, authorization through OpenFGA, monitoring through Alloy), see `docs/incus-installation.md` of the Ansible repository. The BGP peers are on the Incus `UPLINK` and a forward on 10.12.0.0/24 was tested end to end. Left: the north-south link of `comp-opti-03` (no carrier) and of `comp-opti-01` (100 Mbit/s), tracked in phorge-fr/Ansible#11 and #12. -- **HPC and AI**: the `hpc-servers` Ansible role (LiteLLM gateway, llama.cpp servers, monitoring) is not wired to a playbook yet. -- **Provisioning**: Crossplane on the control cluster. -- **Backups**: Longhorn on core backing up to rustfs on the storage node. - -Each of these needs router rules that do not exist yet: see the last rows of the [flow table](#traffic-flows). - -## Known inconsistencies - -Things that disagree between files or between a file and the live router. None is fixed by this document. - -1. DHCP pools span `.1` to `.253` of every cluster VLAN, so they overlap the nodes (`.1`-`.3`), the API virtual IP (`.4`) and the Cilium pool (`.10`-`.20`). -2. The `nfs-uncritical` StorageClass on `control` and `core` points to NFS server 10.6.0.1. No 10.6.0.0/24 network exists on the router. -3. HAProxy targets 10.1.0.11 that the firewall does not allow (about 406,000 packets dropped by `Drop Containers to phorge` in the 3 days before 2026-09-20, most of them towards 10.10.0.1-3:8443 until `Allow Hproxy to Incus cluster API` was added). -4. The GPU host is `ai-z440-01` in the inventory, holds a DHCP lease (10.5.0.4) under the hostname `hpc1`, has no DNS record, and is outside `ai-nodes` (10.5.0.1-2). The HPC monitoring config scrapes `hpc0.phorge`. -5. The FrontPlane README bootstraps Flux from a repository called `Hangar`. -6. The three clusters share the pod and service CIDRs (10.244.0.0/16, 10.96.0.0/12), which rules out a future cluster mesh or direct pod routing between them. -7. `base_configuration.rsc` disables `ether10`, the intended switch uplink. - -## Change checklists - -**New VLAN or cluster** - -1. Network: one entry in `networks` (the VLAN, the router address, the DHCP pool and server, the `phorge` interface list membership and the `-nodes` address list are derived), plus `dns_records`. -2. Ansible: inventory group, `firewall_allowed_ports` and `firewall_trusted_sources` in its `group_vars`. -3. FrontPlane: `clusters//setup/` (k0s config, `ip-pools.yml`, the interface name in `l2announcementpolicy.yml`) and the Traefik patches in `overlays//controllers/traefik/`. -4. If it is published: `ingress = 11` on its entry in `networks`, `templates/haproxy.cfg.tftpl`, then a router rule towards its ingress with `dst_ingress`. -5. Update this document. - -**New flow between two VLANs** - -1. Router: a rule in `firewall_rules` with a unique `id`, `before = "defconf: drop invalid"` (forward accepts) and `in_interface` set. -2. Host: `firewall_allowed_ports` (or `firewall_published_ports` for Docker) in Ansible. -3. Pods: a NetworkPolicy or CiliumNetworkPolicy in FrontPlane if the destination is a pod. -4. After applying, check that the rule counts packets: `/ip firewall filter print stats`. - -**New public hostname** - -1. DNS record at Cloudflare. -2. FrontPlane: an Ingress with class `traefik-public` and `cert-manager.io/cluster-issuer: public-issuer`. -3. `templates/haproxy.cfg.tftpl`: the host in the HTTP redirect ACLs and a `use_backend` line on the SNI frontend. After `tofu apply` the container reloads by itself. -4. A router rule from `containers` to that cluster's ingress, if it is a new cluster.