Repository navigation
Add Ansible deployment for DingoCache (etcd, dfkv_mds, dfkv_server) - #1
Merged
Merged
Conversation
ansible.cfg, the collection list, and a CI job that does exactly two things: parse every YAML file and --syntax-check every playbook. There is no ansible-lint here on purpose -- see the sibling ansible-dingofs for why. Co-Authored-By: Claude Code <noreply@anthropic.com>
Six structural groups. Roles are selected by group, never by a node-name pattern: the rollout this replaces inferred "is this an MDS?" from `*-cpu-*` in the hostname, which was wrong on bj11 where the MDS nodes are named `bj11-dingofs-00NN`. Capacity is deliberately not a per-node variable -- it is derived from the disks the node actually has. What remains per-node are the values that differ by hardware: the advertise interface, the RDMA rails, the RAM tier budget. Co-Authored-By: Claude Code <noreply@anthropic.com>
A release is fetched once on the control node and pushed from there, so a 70-node region downloads it once. Two independent gates: the download is checked against the release published SHA256SUMS, and the unpacked tree is checked again on the target. The launcher scripts are copied into each release directory and never rewritten, which is what makes a rollback safe: flipping `current` back to an older release also restores its launcher, so an older binary is never handed a flag it does not understand. Co-Authored-By: Claude Code <noreply@anthropic.com>
Three checks that fail at phase 0 rather than part-way through a deploy:
* every device named in dfkv_rdma_dev exists on the node. Measured on bj09:
the 200b nodes have ib7s400p0-7 while the 300x node has only p0-3, and
naming a device that is not there narrows the usable rails silently.
* a cache node has at least one mounted /mnt/disk*, so a node with no data
disk fails before the release is pushed to it.
* the RDMA userspace providers are installed. Exposing a device does not make
it discoverable -- ibverbs-providers is the package that does.
Only real mount points count. statvfs on a plain directory reports the
filesystem behind it, so an unmounted /mnt/diskN would measure as the root disk.
Co-Authored-By: Claude Code <noreply@anthropic.com>
Capacity is a fraction of each disk, not a number written into region config, matching how dingo-cache sizes itself -- both systems run over the same NVMes. The disk selection is ported from roles/dingo_cache in ansible-dingofs: drop disks below a floor, keep only the largest same-size group, take a fraction of the smallest one, round down to a whole 1 GiB extent. Keeping the same-size group is doing more work than it looks like. dfkv splits --cap evenly across its directories and applies ONE --disk-hash-weight to every disk, and its CLI has no per-disk form for either. Both are only correct when the disks are the same size, so homogeneity is established before dfkv sees them and its uniform weight becomes capacity-proportional by construction. Without it a mixed node is actively broken: the small disk gets the same cap/n budget as the large ones and slab fails laying down extents it cannot fit. Co-Authored-By: Claude Code <noreply@anthropic.com>
etcd is pinned independently of the dfkv release -- it ships in neither the tarball nor this repo. The unit carries an 8 GiB quota and periodic compaction, which are not optional: client registration and lease keepalives rewrite keys continuously, so the revision counter climbs even though the key count is stable. At etcd 2 GiB default that ends in ALARM NOSPACE, where the ring reports members=0 and every dfkv_server keeps serving perfectly. Member names must be the OS hostname, not the inventory name, and --etcd takes host:port with no scheme: dfkv_mds adds the scheme itself, so a scheme there produces http://http:// and every etcd call fails. Co-Authored-By: Claude Code <noreply@anthropic.com>
The upstream compose file is already DFKV_* variable driven, so a region lives in a rendered .env rather than a re-rendered compose. Only prometheus.yml is rendered, because its scrape targets are this region nodes -- deliberately the declared set, not the live ring, so a node that falls out of the ring does not also vanish from monitoring. Client artifacts are published under an explicit version directory and never behind a `current` symlink: a symlink flip on a lazily-consistent network filesystem resolves differently on different nodes for a window of seconds, and engines in one ring that load different builds derive different cache identities and quietly miss each other. Co-Authored-By: Claude Code <noreply@anthropic.com>
The previous tooling walked nodes.txt and reported a healthy cluster for 13 days while a node that had been removed from that list -- but never disabled -- came back on reboot, re-registered, and served 2.7% of the keyspace. So the ring is asked what it contains and that is compared against what the region declares: every member on the target version, RDMA depth and RAM arena, and an etcd registration count that matches the ring. A mismatch is reported as a mismatch and never narrowed to make the output green. Co-Authored-By: Claude Code <noreply@anthropic.com>
Each phase is a standalone playbook and dfkv_site.yml sequences them. The order is load-bearing: etcd is the only authoritative state and must be healthy before any MDS starts, because an MDS that cannot reach etcd exits rather than degrading; the MDS must be up before any server, because a server first registration has a hard 60s deadline and it exits 1 on expiry. 10_upgrade.yml rolls MDS before servers, following the upstream deployment guide -- an older MDS does not recognise kListTopology, so a modern server polling it fails the call and keeps its last-good ring, which freezes the ring silently. Activation per node is RAM gate, flip, restart, wait for the version to report itself, RAM gate again. Rollback is the same playbook pointed at the previous version. Co-Authored-By: Claude Code <noreply@anthropic.com>
Includes the parts that are only learnable by running it: why there is no host tuning phase, why the capacity is a ratio, why an already-staged release is immutable, and what a capacity change on a running node actually costs. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the deployment automation for DingoCache (
dfkv): the etcd quorum,dfkv_mds,dfkv_server, the per-region telemetry stack, and clientpublication.
This replaces a hand-rolled fleet tooling (
dfkv_fleet.shand friends) withplaybooks and roles in the shape of the sibling
ansible-dingofs.What is here
00_check_config.yml01_prepare.yml03_release.yml04_etcd.yml05_mds.ymldfkv_mds06_server.ymldfkv_server09_verify.yml07_observability.yml10_upgrade.ymldfkv_site.ymlsequences them for a greenfield cluster; every phase is also astandalone playbook.
Three things worth reading before review
Capacity is a fraction of each disk, not a number in config. Both dfkv and
dingo-cache size themselves from the same NVMes, so both now use a ratio. The
disk selection is ported from
roles/dingo_cachehere, and keeping thelargest same-size group is load-bearing rather than tidiness: dfkv splits
--capevenly and applies one--disk-hash-weightto every disk, so mixingdisk sizes gives the small disk a budget it cannot hold.
A release directory is immutable once staged, because the launcher inside
it is what a rollback would run.
A capacity change on a running node discards its cache. slab will not
reopen a directory laid out for a different capacity, so
--capcannot beedited in place. The flag is named for what it does
(
dfkv_server_wipe_on_capacity_change).Verified
Run end to end against a live bj09 canary (
bj09-gpu-300x-0088, and acapacity migration on
bj09-gpu-200b-0022): deploy, re-run idempotency(
changed=0), ring membership, and the production ring left untouched while asecond, isolated group was used.
Co-Authored-By: Claude Code noreply@anthropic.com