plugin/etcdv3: Add etcd v3 plugin (#1702)

* Update dependencies and add etcdv3 client

* Update etcd plugin to support etcd v3 clients

Fixes #341
This commit is contained in:
Nitish Tiwari
2018-06-30 20:49:13 +05:30
committed by Miek Gieben
parent f3afd70021
commit 6fe27d99be
10327 changed files with 4196998 additions and 82 deletions

View File

@@ -11,7 +11,7 @@ import (
"github.com/coredns/coredns/plugin/pkg/upstream"
"github.com/coredns/coredns/plugin/proxy"
etcdc "github.com/coreos/etcd/client"
etcdcv3 "github.com/coreos/etcd/clientv3"
"github.com/mholt/caddy"
)
@@ -124,22 +124,22 @@ func etcdParse(c *caddy.Controller) (*Etcd, bool, error) {
}
etc.Client = client
etc.endpoints = endpoints
return &etc, stubzones, nil
}
return &Etcd{}, false, nil
}
func newEtcdClient(endpoints []string, cc *tls.Config) (etcdc.KeysAPI, error) {
etcdCfg := etcdc.Config{
func newEtcdClient(endpoints []string, cc *tls.Config) (*etcdcv3.Client, error) {
etcdCfg := etcdcv3.Config{
Endpoints: endpoints,
Transport: mwtls.NewHTTPSTransport(cc),
TLS: cc,
}
cli, err := etcdc.New(etcdCfg)
cli, err := etcdcv3.New(etcdCfg)
if err != nil {
return nil, err
}
return etcdc.NewKeysAPI(cli), nil
return cli, nil
}
const defaultEndpoint = "http://localhost:2379"