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.

flowchart TD U[Engineer workstation] --> V{Cisco AnyConnect tunnel} V -- Established --> E[Edge gateway / Envoy] V -- Dropped --> R[Reconnect via OCaml coordinator] E --> O[OCaml mesh coordinator] O --> K[Kafka routing event log] O --> C[Cloud storage gateway] C --> S[(Multi-cloud buckets)] O --> M[Mesh network underlay] M --> W[WireGuard + eBPF data plane] W --> D[Design asset cache] D --> U O --> P[OPA policy engine] P --> A[Audit stream] A --> S R --> O

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.