Files
homelab/kubernetes/apps/otbr/pvc.yaml
k.rennerandClaude Opus 4.7 24d7aa0418 feat(otbr): persistent dataset + idempotent bootstrap on clean install
Three pieces wired together so OTBR survives container restart and
recovers from a clean PVC without manual intervention:

  1. otbr-data PVC mounted at /var/lib/thread/. Persists OpenThread's
     active dataset, child table, MLE/MAC frame counters, and partition
     state across container restarts. Without it the BR re-elects
     leadership and triggers a network reconverge on every restart.

  2. otbr-dataset-bootstrap Job + sops-encrypted dataset Secret. On a
     clean install (PVC empty), the Job sees no active dataset, runs
     the proven bring-up sequence (ifconfig up → dataset set active
     <hex> → thread start) via kubectl exec, and verifies attach.
     Idempotent: exits 0 immediately if the dataset is already
     configured, so subsequent Flux reconciles are no-ops.

  3. Entrypoint patch + post-start activator. The wrapper now sed-
     injects --auto-attach=0 into the upstream entrypoint's
     OTBR_AGENT_OPTS line so otbr-agent boots into `disabled` even
     when /var/lib/thread already has a saved dataset. Without this,
     SLZB-06P7 firmware crashes the agent on every restart: dataset
     load triggers KeyManager → otPlatRadioSetMacKey, the RCP rejects
     with INVALID_STATE because the PHY is still DISABLED, and the
     agent fatal-exits. After the entrypoint is up, the wrapper
     activates Thread (ifconfig up → thread start) only if a dataset
     is persisted; otherwise it waits for the bootstrap Job.

Active dataset TLV is the existing Nest network's (extPanId
cc4a4a491d2358c5, name NEST-PAN-339C), exported from HA's
/config/.storage/thread.datasets so this OTBR joins the same Thread
partition instead of forming a new one.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 16:15:14 +02:00

20 lines
620 B
YAML

---
# Persists OpenThread's settings storage (network key, dataset, child
# table, partition state) at /var/lib/thread/. Without it the dataset
# is wiped on every container restart and the BR has to be re-seeded
# (and re-elects partition leader, which costs a network reconverge).
#
# Small allocation: typical settings file is ~1 KB; 256Mi is overkill
# but matches zone-configurator and gives Ceph block reasonable headroom.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: otbr-data
spec:
accessModes:
- ReadWriteOnce
storageClassName: ceph-block
resources:
requests:
storage: 256Mi