Skip to content

How It Works

Each service’s three replicas form their own Raft ring on port 7480. Curator connects to SunLink on 127.0.0.1:2181 and runs its standard recipes.

Architecture

  • Each service’s three replicas form one Raft ring (Apache Ratis) on port 7480 over mTLS. There is no ring spanning services.
  • A ZooKeeper-protocol endpoint listens on 127.0.0.1:2181 for the in-process Curator and other local ZooKeeper clients.
  • ZooKeeper semantics (znodes, sessions, watches, multi) are mapped onto the Ratis state machine.
  • Writes are linearizable, and reads are served from the leader.

Ports

PortBindPurpose
2181127.0.0.1ZooKeeper protocol for the in-process Curator and other local ZK clients
7480pod IP, mTLSRatis ring traffic between the service’s replicas

Configuration

SunLink reads no environment variables itself. The embedding service passes a SunLinkConfig:

FieldMeaning
nodeIde.g. bubbl-1, from the StatefulSet pod name
peersFrom <SVC>_SUNLINK_CLUSTER or headless-service DNS
dataDirRaft log and snapshots (on the PVC)
clientPortDefault 2181
ringPortDefault 7480
tlscert-manager keystore and truststore
sessionTimeoutDefault 10 seconds

Public Kotlin API

MemberPurpose
start()Start the node and join the ring
curatorA CuratorFramework connected to 127.0.0.1:2181
leaderLatch(path)A LeaderLatch, e.g. on /<svc>/leader
withLock(path, timeout, block)Run a block under an InterProcessMutex
members()Live replicas, from ephemeral nodes under /<svc>/members
onMembershipChange(listener)Be told when replicas join or leave
isLeaderWhether this replica currently leads

Scope

Out of scope: ACLs beyond world:anyone on localhost, quotas, and the four-letter-word admin commands.