Skip to content

Make clustering optional: single-node deployments no longer require etcd - #1

Closed
ossko wants to merge 2 commits into
devfrom
pr/optional-clustering
Closed

ossko wants to merge 2 commits into
devfrom
pr/optional-clustering

Conversation

@ossko

@ossko ossko commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Introduces a cluster.Coordinator interface with two implementations:

  • EtcdCoordinator (today's embedded etcd server), used whenever clustering is enabled - semantics unchanged
  • LocalCoordinator, a single-node coordinator with no etcd and no relay listener: the local node is always leader, the cluster is a singleton and assignments-paused flags live in memory. The gin realtime event handler already handles a nil relay, so single-node event paths are unchanged.

ColoniesController now depends on Coordinator instead of *EtcdServer. CreateServer/CreateColoniesController gained a clusterEnabled parameter (ServerConfig.ClusterEnabled defaults to enabled for backward compat). CLI: new --cluster flag (default true, COLONIES_CLUSTER env override); --initial-cluster is rejected when clustering is disabled. --dbtype help text no longer mentions the unsupported velocitydb type.

Tests: the test harness honors COLONIES_TEST_CLUSTER (default true keeps today's behavior). With COLONIES_TEST_CLUSTER=false the same suites run against the LocalCoordinator: handlers sweep 4m22s -> 2m06s, pkg/fs 22s -> 2.2s, all green. Cluster-specific suites (StartCluster, distributed and exclusive assignment, channel maintenance) always use real etcd.

All suites pass in both modes; cluster unit tests cover the LocalCoordinator.

ossko added 2 commits October 28, 2026 09:49
Introduces a cluster.Coordinator interface with two implementations:
- EtcdCoordinator (today's embedded etcd server), used whenever clustering
  is enabled - semantics unchanged
- LocalCoordinator, a single-node coordinator with no etcd and no relay
  listener: the local node is always leader, the cluster is a singleton and
  assignments-paused flags live in memory. The gin realtime event handler
  already handles a nil relay, so single-node event paths are unchanged.

ColoniesController now depends on Coordinator instead of *EtcdServer.
CreateServer/CreateColoniesController gained a clusterEnabled parameter
(ServerConfig.ClusterEnabled defaults to enabled for backward compat).
CLI: new --cluster flag (default true, COLONIES_CLUSTER env override);
--initial-cluster is rejected when clustering is disabled. --dbtype help
text no longer mentions the unsupported velocitydb type.

Tests: the test harness honors COLONIES_TEST_CLUSTER (default true keeps
today's behavior). With COLONIES_TEST_CLUSTER=false the same suites run
against the LocalCoordinator: handlers sweep 4m22s -> 2m06s, pkg/fs
22s -> 2.2s, all green. Cluster-specific suites (StartCluster, distributed
and exclusive assignment, channel maintenance) always use real etcd.

All suites pass in both modes; cluster unit tests cover the LocalCoordinator.
@ossko ossko closed this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant