At ShitOps, our distributed hardware team needs to move multi-gigabyte CAD exports between offices, airports, and coffee shops. The current workflow is a shared Cloud storage bucket plus Cisco AnyConnect. It works until a VPN session drops during a Mesh network handoff, the Cloud storage manifest is stale in one region, or an engineer edits a file that another engineer already replaced. We decided to solve this properly with a real-time, self-healing control plane written in OCaml.
The Problem¶
Remote engineers need low-latency, consistent, auditable access to Cloud storage assets. Cisco AnyConnect gives us a secure tunnel, but it has no awareness of Mesh network topology changes. When a laptop moves from office Wi-Fi to a hotspot, the tunnel reconnects and the Mesh network view is rebuilt from scratch. Meanwhile, Cloud storage replication is eventually consistent, so the client can read an old manifest while a newer object exists in another region. We need zero-copy access, automatic failover, policy enforcement, and a full audit trail.
Solution Architecture¶
We built MeshAnyConnectCloudBridge. It combines an OCaml mesh coordinator, Cisco AnyConnect posture orchestration, and a multi-cloud Cloud storage gateway.
The OCaml mesh coordinator is the brain. It runs as a Kubernetes operator and compiles to native code for the data plane and WebAssembly for browser-side health checks. It maintains a CRDT-based routing table that is fed by a Kafka event log. Every Cisco AnyConnect session gets a SPIFFE identity, which OPA validates before the coordinator admits the session into the Mesh network. A Go sidecar handles the Cisco AnyConnect headless client, but all routing decisions stay in OCaml.
The Cloud storage gateway is an OCaml service that speaks gRPC, GraphQL, and S3-compatible APIs. It writes to replicated buckets across three clouds and keeps a Redis-backed manifest cache. When a file is requested, the gateway consults the OCaml coordinator for the nearest Mesh network node, then streams the object through an Envoy filter chain. The filter chain performs token exchange, mTLS termination, and eBPF-based rate limiting.
The Mesh network underlay uses WireGuard plus Istio ambient mesh. Envoy handles east-west traffic, while an eBPF program in the kernel performs load balancing and drop detection. If a Cisco AnyConnect tunnel drops, the OCaml coordinator receives a Kafka event and pushes a new route to the Mesh network within milliseconds. The workstation reconnects, receives a fresh SPIFFE token, and resumes the Cloud storage stream from the last acknowledged offset.
Identity and Policy¶
We use SPIFFE and SPIRE to issue workload identities to every Cisco AnyConnect session and every Mesh network node. Vault acts as the root certificate authority and rotates short-lived certificates every fifteen minutes. OPA evaluates Rego policies that combine user identity, device posture, Cloud storage bucket tags, and Mesh network locality. If a policy fails, the OCaml coordinator removes the node from the routing table and publishes a denial event to Kafka. Kyverno enforces the same policies inside Kubernetes, while Crossplane provisions bucket-level IAM and replication rules.
Data Plane Optimizations¶
The data plane is tuned for CAD exports. We use jumbo frames on the WireGuard interfaces, zero-copy sendfile for Cloud storage streams, and an eBPF sockmap to bypass the kernel TCP stack for same-node transfers. The design asset cache is a local NVMe tier managed by the OCaml coordinator. Cache entries are keyed by content hash and signed by Vault. When a file changes, the Cloud storage gateway emits an event to Kafka, and the coordinator invalidates the matching cache entries across the Mesh network. We also run Thanos for long-term Prometheus metrics, Loki for logs, and Tempo for traces.
Deployment Flow¶
A typical request starts on an engineer workstation. Cisco AnyConnect establishes the tunnel, the edge Envoy proxy forwards the request, and the OCaml coordinator resolves the file location. The Cloud storage gateway checks the Redis manifest cache, validates the object against the Kafka event log, and streams the asset through the nearest Mesh network node. The audit stream writes an immutable record to Cloud storage.
Terraform and Pulumi provision the multi-cloud buckets, VPCs, and WireGuard endpoints. Argo CD deploys the OCaml operator with a canary rollout. GitHub Actions runs property-based tests on the CRDT routing table, integration tests against a simulated Mesh network, and chaos tests that kill Cisco AnyConnect sessions at random intervals. Grafana dashboards show Cisco AnyConnect session health, Mesh network topology, Cloud storage replication lag, and OPA policy decisions.
Failure Handling¶
When a Cisco AnyConnect session fails, the edge Envoy proxy marks the tunnel unhealthy and the OCaml coordinator schedules a reconnect through the least-loaded Mesh network relay. The coordinator writes a lease to Redis and a compensating event to Kafka. If the Cloud storage gateway cannot reach the primary bucket, it falls back to a read-only replica and records the lineage in the audit stream. A background reconciler compares object hashes across clouds and repairs divergence by replaying the Kafka event log. This keeps the platform consistent even when the network is not.
Why This Works¶
This design gives us a single control plane for Cisco AnyConnect sessions, Mesh network routing, and Cloud storage access. The OCaml coordinator is small, fast, and easy to reason about. Kafka provides a durable event log for replay. OPA gives us policy as code. Envoy and eBPF give us deep traffic control. The multi-cloud Cloud storage gateway removes single-region staleness. The result is a secure, scalable, self-healing platform that our engineers can trust.
Comments 4
Priya N. Ops
I love the ambition, but this reads like every distributed-systems buzzword got together for a team-building retreat. OCaml coordinator + Kafka + CRDT + SPIFFE + OPA + Envoy + eBPF + WireGuard + Istio + Crossplane is a lot of moving parts for moving CAD files. How do you debug a failed file open at 2 a.m. without a PhD in this exact stack?
Marcus T. Network
The debugging concern is real. The Kafka event log is probably the only saving grace, but you still need a way to correlate a user request across AnyConnect, Envoy, OPA, and the storage gateway. I would want a single trace ID front and center.
Bartholomew Q. Stacktrace Author
Fair challenge. We instrument every hop with OpenTelemetry and Tempo, and the Kafka event carries the same trace ID from AnyConnect posture check through OPA decision and storage stream. The coordinator also exposes a replayable decision log. It is still complex, but the failure path is auditable.
Priya N. Ops
Auditable is not the same as easy to operate. Who owns the OCaml operator when it pages at 3 a.m.? The Go sidecar? The Envoy config? That boundary matters.
Elena K. Distributed Systems
The CRDT routing table is the part I want to hear more about. What happens when two regions disagree about the nearest Mesh node after a partition? Do you favor availability and accept stale routing, or does OPA block until the CRDT converges?
Bartholomew Q. Stacktrace Author
We favor availability for routing but enforce safety at the storage gateway. The CRDT converges on topology, while object reads require a manifest version that matches the Kafka log. If OPA sees a stale route, it can deny or redirect based on policy. So routing can be eventually consistent; data access cannot.
Elena K. Distributed Systems
That split makes sense, but redirects can still surprise users mid-stream. Do you resume from the acknowledged offset, or restart the transfer?
Sam R. SRE
The eBPF sockmap and zero-copy sendfile bits are cool, but they also sound like a great way to create kernel-version-specific bugs that only reproduce on one engineer's laptop. How do you test that across the fleet?
Sam R. SRE
This. We tried eBPF sockmap for a smaller project and spent more time on kernel compatibility than on the actual feature.
Bartholomew Q. Stacktrace Author
We pin kernel versions on managed workstations and run chaos tests in CI against the same kernel matrix. For unmanaged devices, the coordinator falls back to the standard TCP path. The sockmap optimization is not on the critical path.
Tariq A. Security
Security question: Vault rotates certs every 15 minutes and SPIFFE identities every session. What happens to an in-flight multi-gigabyte CAD stream when a cert rotates? Does it fail closed and force a reconnect?
Tariq A. Security
Also curious about the audit stream. If a session is denied by OPA, is the denial event written before or after the coordinator removes the node? Ordering matters for forensics.