Files
floci/docs
Kurt McAlpineandkurtmc 97ff0bc3e9 feat(elasticache): support cluster-mode replication groups (#2633)
* feat(elasticache): support cluster-mode replication groups

CreateReplicationGroup now provisions a real sharded Valkey cluster when
the request asks for one (NumNodeGroups > 1, a cluster.on parameter
group, or ClusterMode=enabled): one cluster-enabled container per node,
formed via config epochs, MEET, slot assignment and replica attachment,
each fronted by its own auth-proxy port announced to clients via
cluster-announce-client-ipv4/cluster-announce-port so CLUSTER SLOTS and
MOVED redirects point at reachable addresses.

DescribeReplicationGroups reports the topology honestly (ClusterEnabled,
NodeGroups with Slots, MemberClusters, Engine, ARN, AutomaticFailover),
and replication-group members answer DescribeCacheClusters, which is
where terraform-provider-aws reads node type, engine version and port
from.

Adds a terraform compatibility test that applies an
aws_elasticache_replication_group with num_node_groups and
replicas_per_node_group, asserts the data plane is a formed cluster
running in cluster mode (INFO cluster / CLUSTER INFO over RESP through
the proxy), and that a re-plan straight after apply is clean.

* fix(elasticache): address cluster-mode review feedback and compat CI failure

- bump compat-terraform aws-cli image to 2.34.32 so botocore models
  include ReplicationGroup.Engine (old pin silently dropped the field)
- restore cluster-mode runtime state (ports, containers, proxies,
  cluster formation) after restart; mark groups create-failed on error
- announce configured hostname to Valkey nodes so MOVED redirects and
  CLUSTER SLOTS return client-reachable endpoints
- log swallowed socket-close failures in cluster formation

* fix(elasticache): report restore-failed members and modeled node-group quota fault

Review follow-up for cluster-mode support:

- Member cache clusters mirror their group's status instead of a
  hardcoded "available", so a group marked create-failed by a failed
  restore no longer contradicts its own members in
  DescribeCacheClusters. CacheClusterStatus has no create-failed value,
  so failed members report the documented restore-failed.
- NumNodeGroups above the 500 ceiling surfaces the modeled
  NodeGroupsPerReplicationGroupQuotaExceeded fault instead of a generic
  InvalidParameterValue.
- Javadoc names ClusterMode=compatible handling and the
  cluster-mode-only restore scope as deliberate.

* fix(elasticache): announce a client-resolvable hostname for cluster mode

Cluster-mode nodes announced FLOCI_HOSTNAME verbatim, so the shipped
Docker Compose deployment baked the Compose-only name 'floci' into
MOVED/ASK redirects and topology responses, breaking cluster-aware
clients connecting from outside the Compose network.

Add FLOCI_SERVICES_ELASTICACHE_CLUSTER_ANNOUNCE_HOSTNAME (default:
FLOCI_HOSTNAME) used for the announced name and the reported
ConfigurationEndpoint, and set it to localhost.floci.io in
docker-compose.yml — public DNS resolves it to 127.0.0.1 on the host
while the network alias and Floci's embedded DNS resolve it to the
Floci container from inside Docker.

* fix(elasticache): restore cluster-mode groups without blocking startup

Restoring persisted cluster-mode groups ran serially in the synchronous
startup path, so a slow or unavailable Docker daemon could hold up
emulator readiness by a container-readiness plus cluster-formation
timeout per group, timing out readiness-dependent clients such as
Testcontainers.

restorePersistedRuntime now reserves each node's proxy port and marks
groups creating synchronously - so no request can claim a persisted
port or see a stale available status - then brings containers, cluster
formation and proxies back in the background, flipping each group to
available or create-failed as its restore finishes.

---------

Co-authored-by: kurtmc <2661907+kurtmc@users.noreply.github.com>
2026-08-28 16:00:33 -04:00
..
2026-03-15 17:43:56 -05:00