Skip to content

eBPF-based security platform

testing: sync and report every 10 seconds in a local-stack VM

John Fastabend287806a63959
diff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rst
index f0bf67ed..240f9356 100644
--- a/Documentation/contribute/testing/testing.rst
+++ b/Documentation/contribute/testing/testing.rst
@@ -834,7 +834,13 @@ BPM tree at ``oci://10.0.2.2:15444/shirudo/local-tree``, reference
``stable``. The guest also forwards its own ``127.0.0.1:15444`` to
``10.0.2.2:15444``, with ``systemd-socket-proxyd``: the host publishes at
``127.0.0.1:15444``, a tree operation names its package by the address
-it was appended through, and the registry's certificate covers both. The existing timers retry exports and tree sync when services
+it was appended through, and the registry's certificate covers both.
+Drop-ins make ``shirudo-bpm-tree-sync.timer`` fire every 10 seconds
+there and ``shirudo-keepalive.timer`` 10 seconds after each keepalive,
+where a target's wait a minute, so that an operation appended to the
+tree reaches the VM, and the VM's record of it the backend, at once. The
+backend still refreshes its node history and status every minute. The
+existing timers retry exports and tree sync when services
are unavailable; starting the containers later needs no VM reboot.
The registry starts empty. Publish a signed tree at that reference using
the VM bundle's operator key under ``TEST_VM_HOST_PRIVATE_DIR`` to load
diff --git a/testing/vm/guest.sh b/testing/vm/guest.sh
index b51fcec2..6f2374af 100755
--- a/testing/vm/guest.sh
+++ b/testing/vm/guest.sh
@@ -291,6 +291,28 @@ forward_stack_registry()
systemctl enable --now shirudo-stack-registry.socket
}
+# A local-stack VM is there to try a tree on: it looks for a new
+# operation and reports what it applied every 10 seconds, where a target
+# does each every minute.
+quicken_local_stack_timers()
+{
+ install -d /etc/systemd/system/shirudo-bpm-tree-sync.timer.d \
+ /etc/systemd/system/shirudo-keepalive.timer.d
+ cat >/etc/systemd/system/shirudo-bpm-tree-sync.timer.d/local-stack.conf <<-'EOF'
+ [Timer]
+ OnBootSec=
+ OnUnitActiveSec=
+ OnBootSec=10s
+ OnUnitActiveSec=10s
+ EOF
+ cat >/etc/systemd/system/shirudo-keepalive.timer.d/local-stack.conf <<-'EOF'
+ [Timer]
+ OnUnitInactiveSec=
+ OnUnitInactiveSec=10s
+ EOF
+ systemctl daemon-reload
+}
+
write_target_test_env()
{
{
@@ -545,6 +567,7 @@ if [[ "${TEST_VM_LOCAL_STACK:-0}" == 1 ]]; then
printf '%s\n' 'BPM_OCI_CA_FILE=/usr/local/share/ca-certificates/shirudo-oci-ca.crt' \
>/etc/shirudo/bpm/environment
forward_stack_registry
+ quicken_local_stack_timers
fi
if [[ -n "${TEST_VM_BPM_TREE_INPUT:-}" ]]; then