Search code examples
coreosetcd

libkv / ectd go client : how to use config.TLS object?


Trying to use docker/libkv

https://github.com/docker/libkv#tls

which specifies that etcd and consul support TLS using a config.TLS object

I'm trying to figure the format of this object.

The etcd go client that libkv uses is here:

https://github.com/coreos/etcd/tree/master/client

but there is no doc about this feature and the code itself has barely any reference to TLS

So my question is 2 parts:

  • Does anyone know if indeed the coreos/etcd client supports TLS? (I believe it must since docker/libkv uses it and claims to support it, but I'm having some doubts here)

  • Does anyone have an example of the config.TLS object format?

Thanks for your input

PS: I did ask the question there, but figured I'll post here too.


Solution

  • etcd does support TLS configuration. You can find the documentation for this here: https://coreos.com/etcd/docs/latest/security.html

    You can find example code for doing this here: https://github.com/coreos/etcd/blob/master/etcdctl/command/util.go#L252

    In particular look for the gettransport function call that sets up the transport with TLS.