Documentation
¶
Overview ¶
Package shape implements tc HTB hierarchy persistence for the `$EGRESS` physical NIC. It renders the boot-replay script and manages the solo-provisioner-tc-egress.service oneshot unit (design §8.3.2).
Scope boundary (TS_2 #742): this package only covers reboot persistence — rendering the tc-egress.sh script with the NIC name interpolated at install time and installing/enabling the oneshot unit. The full `network shape` CLI verb (Story 1.4) will extend this package with bandwidth-parameterised rendering and the per-class rate/ceil/prio API.
The $VETH HTB is deliberately NOT persisted here: the veth interface does not survive reboot (Cilium recreates it on pod start), so persisting its qdisc would be meaningless. The daemon's pod-lifecycle watcher reinstalls the $VETH HTB on the next pod create event (TS_3).
Index ¶
Constants ¶
const ( // TcEgressScriptPath is the shell script that replays the $EGRESS HTB // hierarchy at boot. It lives under /usr/local/sbin (system admin tools, // root-executable) — not /etc, since it is an executable rather than config. TcEgressScriptPath = "/usr/local/sbin/solo-provisioner-tc-egress.sh" // TcEgressService is the systemd oneshot unit name that executes // TcEgressScriptPath at boot, before solo-provisioner-daemon.service starts. TcEgressService = "solo-provisioner-tc-egress.service" // TcEgressServiceUnitPath is the absolute path where the unit file is // installed so systemd can discover it. TcEgressServiceUnitPath = "/usr/lib/systemd/system/" + TcEgressService )
Variables ¶
This section is empty.
Functions ¶
func ApplyTcEgressScript ¶
ApplyTcEgressScript restarts the tc-egress systemd unit so the kernel picks up the HTB hierarchy immediately after install without waiting for a reboot. RestartService resets a previously-failed unit before running it, so a corrected script takes effect on re-install without a manual reset-failed. Using restart (rather than executing the script directly) keeps the unit state visible: on success the unit shows active (exited), on failure failed — matching what operators see after a reboot.
func DetectEgressInterface ¶
DetectEgressInterface returns the name of the interface that carries the default route — the physical $EGRESS NIC the HTB hierarchy should be attached to. Works for single-NIC hosts (§4.1); multi-NIC support (§4.2) is out of scope and requires --egress-interface to be set explicitly.
Fails with an actionable error when no default route is found (e.g. the routing table is not yet populated or the host has no default gateway).
func EnsureTcEgressUnit ¶
EnsureTcEgressUnit installs (or updates) the solo-provisioner-tc-egress.service unit file, daemon-reloads systemd, and enables the unit for boot. SHA-256 comparison is used so the write, reload, and enable are skipped when the on-disk content already matches the embedded template — making repeated installs cheap while ensuring a template change (e.g. ordering fix) is applied automatically on the next `block node install`.
func RenderTcEgressScript ¶
RenderTcEgressScript renders the tc-egress.sh boot script with the given NIC name and writes it atomically to TcEgressScriptPath (mode 0755). If the on-disk content is already identical (SHA-256 match) the write is skipped and the function returns nil — making it safe to call from idempotent install flows.
Types ¶
This section is empty.