Distributed parallel namerd dtab updates

I’m designing a decentralized system where nodes can “sign up” dynamically to serve particular services. I was picturing using the namerd API to handle this, so if a node is volunteering to serve service xyz then it would add itself to the corresponding dtab entry.

The namerd API doesn’t seem to be suited to this kind of design. Doing a POST to a particular dtab replaces the existing entry, so there will always be race conditions with multiple updates.

I wonder if it would be considered acceptable to update the underlying etcd database directly? Does namerd support this? Etcd already has strong semantics for concurrent updates. Does namerd have a published, stable representation for its etcd entries, and listen for updates?

Failing that, is there any hope that a decentralized system could submit uncoordinated dtab updates? Wrapping namerd in another service is possible, of course, but it’s not all that appealing due to its complexity. Is there any alternative?

This should be possible with the existing namerd APIs, by sending an If-Match header with the request, described here:

https://linkerd.io/config/1.1.3/namerd/index.html#put-api-1-dtabs-lt-namespace-gt

Dtabs are versioned, and if a request includes the If-Match header with a version that doesn’t match the current version, the request will be rejected with a 409. At that point you can fetch the most recent version of the Dtab and try again.

Fwiw, namerctl already implements versioned dtab support, so you might be able to use that utility, rather than implementing it yourself.

1 Like