#!/sbin/openrc-run # k3s-first-boot — one-shot OpenRC service that runs the first-boot publisher # after K3s is up. Self-disables by removing itself from the default runlevel # once the sentinel file is gone. description="K3s first-boot publisher (node-token + admin kubeconfig)" # Backgrounded: the publisher waits up to 5min for K3s /healthz before it can # read the node-token + kubeconfig, so it must not block the default runlevel. # command_background is also required for output_log/error_log — start-stop-daemon # rejects --stdout/--stderr without --background ("Failed to start k3s-first-boot"). command="/usr/local/sbin/k3s-first-boot" command_background="yes" pidfile="/run/k3s-first-boot.pid" # Route to the serial console so the bootstrap publisher's progress (healthz # wait, token/kubeconfig publish, errors) is visible in the orchestrator's # host-side console capture — the VM has no operator login. Low volume. output_log="/dev/console" error_log="/dev/console" depend() { need k3s after k3s } start_pre() { if [ ! -f /var/lib/spinifex-eks/first-boot.pending ]; then einfo "first-boot already complete; nothing to do" return 0 fi }