mirror of
https://github.com/coredns/coredns.git
synced 2026-04-10 14:05:32 -04:00
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:
committed by
Miek Gieben
parent
f3afd70021
commit
6fe27d99be
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user