Loading
Run a lab on the caller's network and firewall
What this changes
A lab can now run on a network and firewall the caller owns.
SIM_NETWORK(defaultdefault) andSIM_SUBNET(optional) apply to every node create (up, geo, Praefect, two-plane, validate, restore recreate, OpenShift nested), every rule create and update, and internal address reservation.SIM_FIREWALL=createis the default and today's behaviour.SIM_FIREWALL=verifycreates and updates no rule. Before any VM create,upfails fast and names each missing reading. A rule matches by what it reads (network, direction, ports, source ranges, target tags), never by name:- ingress tcp:4252 from 35.235.240.0/20 (IAP ssh);
- tcp:80 and tcp:443 from the lab's source ranges, when it exposes them;
- all tcp, udp and icmp from the subnet, for geo, Praefect and two-plane.
preflight.shruns the same check under verify. With verify in token mode it lists and enables no API.- Paths that must make a rule of their own (the airgap seal, the registry guard, two-plane, OpenShift Local's deny rule,
admit) refuse under verify before anything is created.
Verify path
flowchart TD
A["simulation.sh up"] --> B["network_settings_check: SIM_NETWORK, SIM_SUBNET, SIM_FIREWALL"]
B --> C["preflight.sh --iap-only: IAP API and permission"]
C --> D{"SIM_FIREWALL=verify?"}
D -- "no (default)" --> E["ensure_firewall: create the rules, as before"]
D -- yes --> F["firewall_verify_or_fail"]
F --> G["prov_rules_json: gcloud compute firewall-rules list, network~SIM_NETWORK"]
G --> H{"each reading found? IAP tcp:4252 from 35.235.240.0/20; http and https; internal"}
H -- missing --> I["fail naming each reading: no VM, address or rule created"]
H -- all found --> J["prov_node_create --network SIM_NETWORK --subnet SIM_SUBNET"]
E --> JTests
network-selftest.sh is new and runs in just test. Each group fails when its mechanism is reverted:
- every create verb carries
--networkand--subnet, from the stub's recorded args; - verify makes no rule create or update call, down to the provider;
- verify fails before any VM create when a reading is missing, and passes when the rules exist under other names;
- unset sends no
--networkor--subnetand still makes the rules.
preflight-selftest.sh gains four cases for verify and token mode. provider-selftest.sh now covers firewall.sh.
Live run
On a custom network with two pre-made rules under names of their own. The result is recorded in a comment on this MR.
Closes #56 (closed)