feat(deploy): prepare the LXD host for the isolated runner and labs
This commit is contained in:
1 parent
63e6b41bec
commit
56dcf32f8c
4 files changed
+152
No files matched your search
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# Creates the network ACLs referenced by lxd-preseed.yaml (TASK-592).
|
||||
# Run before the preseed. Rules are stateful: replies to allowed traffic pass.
|
||||
set -euo pipefail
|
||||
|
||||
# The ACL filters forwarded traffic before Docker masquerades it, so the
|
||||
# backend is matched by the app subnet; host-side tools come from the bridge
|
||||
# address. The token on the control API, not the source address, authorizes
|
||||
# callers: other containers of the app network reach the port but not the API.
|
||||
app_subnet="${APP_SUBNET:-172.29.79.0/24}"
|
||||
runner_host_side="${RUNNER_HOST_SIDE:-10.80.0.1/32}"
|
||||
runner_port="${RUNNER_PORT:-8443}"
|
||||
|
||||
ensure_acl() {
|
||||
lxc network acl show "$1" >/dev/null 2>&1 || lxc network acl create "$1" </dev/null
|
||||
}
|
||||
|
||||
# Runner: only the app network and host-side tools may open the control API; the
|
||||
# runner VM itself may not start any connection.
|
||||
ensure_acl lincodex-runner
|
||||
for source in "$app_subnet" "$runner_host_side"; do
|
||||
lxc network acl rule add lincodex-runner ingress action=allow protocol=tcp \
|
||||
source="$source" destination_port="$runner_port" 2>/dev/null || true
|
||||
done
|
||||
|
||||
# Lab management: the checker and the console gateway live on the host side
|
||||
# and connect to the nodes; the nodes may not start any connection.
|
||||
ensure_acl lincodex-labmgmt
|
||||
lxc network acl rule add lincodex-labmgmt ingress action=allow protocol=tcp \
|
||||
source=10.81.0.1/32 destination_port=22,8728,8729 2>/dev/null || true
|
||||
|
||||
# Guests get static addresses from the provisioner (cloud-init), so no DHCP
|
||||
# or DNS rule exists: a guest cannot send anything towards the host.
|
||||
lxc network acl list
|
||||
Reference in new issue
Block a user