Coredns: plugin/etcd: Missing example of TXT records

Created on 10 Jul 2018  路  3Comments  路  Source: coredns/coredns

I'm fairly new to DNS and CoreDNS and it was very easy to compile and start Now I'm trying to insert a few TXT records in etcd. Sniffing with wireshark ensures I'm placing the entries at the correct endpoint. But I am missing examples or documentation of records (A, AAAA, MX, TXT) on which paths to put them (including the JSON format). Or I'm reading the documentation wrong of the etcd plugin.

I have read through the sourcecode of the plugin but I can not come up with a correct PUT request to place the TXT record.

https://github.com/coredns/coredns/blob/master/plugin/etcd/etcd.go#L77:

 > curl -XPUT http://127.0.0.1:2379/v2/keys/skydns/org/xor-gate/dorpstraat -d value='{"text":"boembats","ttl":"3000"}'
{"action":"set","node":{"key":"/skydns/org/xor-gate/dorpstraat","value":"{\"text\":\"boembats\",\"ttl\":\"3000\"}","modifiedIndex":6,"createdIndex":6}}

path: /skydns/org/xor-gate/dorpstraat
path error: Key not found

Thanks in advance,
Jerry Jacobs

documentation

Most helpful comment

right. Will do that @miekg

All 3 comments

I think the reason is that the examples are only for etcdv2 but we've already moved to etcdv3. So the records you put in the etcd instance by using etcdv2 API(i.e., both in examples and your command, using[CLIENT_URL]/v2/keys as the endpoint gateway) will not be visible if our plugin using etcdv3.

And also I think we shouldn't use curl API for example, the reasons are as follows:

  • The endpoint gateway depends on the version of etcd. For instance, etcd v3.2 or before uses only [CLIENT-URL]/v3alpha/* while etcd v3.5 or later uses [CLIENT-URL]/v3/* .
  • Key and Value must be base64 encoded in JSON.

Here is a link for details: https://github.com/coreos/etcd/blob/master/Documentation/dev-guide/api_grpc_gateway.md#notes

So maybe using etcdctl is a better choice.

ah, yeah we should totally clean those up; not valid anymore /cc @nitisht

right. Will do that @miekg

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jpds picture jpds  路  5Comments

ghost picture ghost  路  6Comments

Mynom picture Mynom  路  5Comments

miekg picture miekg  路  6Comments

miekg picture miekg  路  3Comments