93 Commits

Author SHA1 Message Date
jiaxuanzhou
ad448fb280 clientv3: keep NewFromURL the same, add method NewFromURLs 2018-03-27 10:40:10 +08:00
jiaxuanzhou
e1bf612ee8 clientv3: optimize func NewFromURL 2018-03-27 09:30:12 +08:00
Hitoshi Mitake
b0ed5c1dd8
Merge pull request #8680 from mitake/auth-cleanup
*: don't use a string literal directly in grpc metadata
2018-03-20 18:19:23 +09:00
Gyuho Lee
3aa5711dca clientv3: move health balancer to "balancer"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-03-19 15:16:11 -07:00
Hitoshi Mitake
b1dd19a7aa *: don't use string literals directly in grpc metadata
Current etcd code uses the string literals ("token", "authorization")
as field names of grpc and swappger metadata for passing token. It is
difficult to maintain so this commit introduces new constants for the
purpose.
2018-03-15 14:17:34 +09:00
Gyuho Lee
1f016f3b96 clientv3: use "pkg/logger"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-05 13:40:58 -08:00
Sahdev P. Zala
3b7e2ce0ca StatusFromError: handle return value of the function
status.FromError can return nil, false. We are handling the return values
most places in code but some places we aren't. Fixing it herewith.

Fixes #9117
2018-01-08 22:28:20 -05:00
Gyuho Lee
497412c588 clientv3: call other APIs with default gRPC call options
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-20 10:58:05 -08:00
Gyuho Lee
63d66b1011 clientv3: configure gRPC message limits in Config
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2017-12-20 10:58:01 -08:00
Manjunath A Kumatagi
18746c65da Clientv3: Fix govet error for gotip 2017-12-15 14:31:27 +05:30
Gyu-Ho Lee
75110dd839 *: fix naked returns
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 18:46:15 -08:00
Gyu-Ho Lee
012b013538 clientv3: combine "healthBalancer" and "simpleBalancer"
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-11-10 15:38:05 -08:00
Gyu-Ho Lee
439c97d465 clientv3: remove balancer interface
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-20 16:31:02 -07:00
Gyu-Ho Lee
0199bdc266 *: fix 'ineffassign' issues
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-10-03 10:14:33 -07:00
Anthony Romano
84db8fdaea clientv3: health check balancer 2017-09-15 14:24:46 -07:00
Gyu-Ho Lee
6f76d52a1a *: deprecate grpc.Code, grpc.ErrorDesc
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-11 09:28:56 -07:00
Gyu-Ho Lee
9a726b424d *: fix leaky context creation with cancel
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-07 13:39:42 -07:00
Gyu-Ho Lee
f65aee0759 *: replace 'golang.org/x/net/context' with 'context'
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-07 13:39:42 -07:00
Anthony Romano
2d0eec0b35 clientv3: goword spelling check 2017-09-06 22:11:33 -07:00
Gyu-Ho Lee
312c68a9c6 clientv3: deprecate grpc.ErrClientConnTimeout errors
Replace with context.DeadlineExceeded.
Address https://github.com/coreos/etcd/issues/8504.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-09-05 14:10:02 -07:00
Anthony Romano
4669aaa9a2 clientv3: only retry mutable KV RPCs if no endpoints found
Was retrying when it shouldn't, causing multiple puts
2017-08-01 12:55:51 -07:00
Saksham Sharma
2a30a754e9 clientv3: add keep-alive to connection
this makes the grpc client connection use a keep-alive.
2017-07-06 12:55:52 -07:00
Gyu-Ho Lee
5e059fd8dc *: use metadata Incoming/OutgoingContext
Fix https://github.com/coreos/etcd/issues/7888.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-15 16:41:23 -07:00
Anthony Romano
ea8561c35c clientv3: support unixs:// scheme
For using TLS without giving a TLSConfig to the client.
2017-05-31 15:51:48 -07:00
Anthony Romano
8effbda3a7 clientv3: use Endpoints[0] to initialize grpc creds
Dialing out without specifying TLS creds but giving https uses some
default behavior that depends on passing an endpoint with https to
Dial(), so it's not enough to completely rely on the balancer to supply
endpoints.

Fixes #8008

Also ctx-izes grpc.Dial
2017-05-31 15:01:11 -07:00
Iwasaki Yudai
aa85b0cea7 clientv3: Do no stop keep alive loop by server side errors 2017-05-08 15:47:34 -07:00
Hitoshi Mitake
e1306bff8f *: simply ignore ErrAuthNotEnabled in clientv3 if auth is not enabled
Fix https://github.com/coreos/etcd/issues/7724
2017-04-19 11:27:14 +09:00
Anthony Romano
9b8e39e7ca clientv3: let client.Dial() dial endpoints not in the balancer 2017-04-12 20:07:03 -07:00
Anthony Romano
d42c1f5131 Merge pull request #7646 from andelf/fix-unix-socket-url
*: fix a bug in handling unix socket urls
2017-04-05 09:24:38 -07:00
andelf
4f27981c46 *: fix a bug in handling unix socket urls
Now use url.Host + url.Path as unix socket path

Fixes #7644
2017-04-05 14:33:13 +08:00
Anthony Romano
62d7bae496 clientv3: respect dial timeout when authenticating
Fixes #7627
2017-03-31 15:14:46 -07:00
Anthony Romano
a2cdd908dc clientv3: permit creating client without grpc connection
For creating client from etcdserver.
2017-03-13 15:23:26 -07:00
Anthony Romano
270dc9427b clientv3: pass back dial error on dial timeout
Fixes #7419
2017-03-06 09:33:10 -08:00
Anthony Romano
4d2aa80ecf clientv3: add cluster version checking 2017-02-16 18:14:14 -08:00
Anthony Romano
c9452c6ad4 clientv3: let user provide a client context through Config 2017-02-16 18:14:14 -08:00
Anthony Romano
8c43bd06a0 clientv3: add DialOptions to config
Removes strict prometheus dependency.

Fixes #7058
2017-02-03 12:00:20 -08:00
Anthony Romano
b465b48476 clientv3: remove strict yaml dependency
Moved to clientv3/yaml
2017-02-01 21:02:45 -08:00
Anthony Romano
56286ccd29 clientv3: use DialContext
Fixes #7216
2017-01-25 09:49:41 -08:00
Hitoshi Mitake
d431b64d97 etcdserver, clientv3: handle a case of expired auth token
This commit adds a mechanism of handling a case of expired auth token
to clientv3. If a server returns an error code
grpc.codes.Unauthenticated, newRetryWrapper() tries to get a new token
and use it as an option of PerRPCCredential.

Fixes https://github.com/coreos/etcd/issues/7012
2017-01-12 11:49:02 +09:00
Anthony Romano
246fb29d8a clientv3: close Lease on client Close
Fixes #6987
2016-12-14 12:11:17 -08:00
Gyu-Ho Lee
a08103c088 clientv3: return copy of endpoints, not pointer
Fix https://github.com/coreos/etcd/issues/6892.
2016-11-23 11:33:54 -08:00
sharat
8fd1dd7862 clientv3: added client side metrics support 2016-10-27 22:47:45 +05:30
Anthony Romano
c100e40715 clientv3: only receive from closing streams in Watcher close
Was overcounting the number of expected closing messages; the resuming
list may have nil entries. Also the full client wasn't closing the watcher
client, only canceling its context, so client closes weren't joining with
the watcher shutdown.

Fixes #6605
2016-10-20 15:33:11 -07:00
Gyu-Ho Lee
084c407a8d clientv3: drop Config.Logger field
Fix https://github.com/coreos/etcd/issues/6603.

Instead adds 'SetLogger' to set global logger interface
to avoid unnecessary logger updates.
2016-10-11 16:38:32 -07:00
Gyu-Ho Lee
f45542394b clientv3: handle 'https' scheme in endpoint 2016-10-03 01:03:28 -07:00
Gyu-Ho Lee
cdb1e34799 clientv3: add 'Sync' method 2016-09-21 09:10:25 -07:00
Gyu-Ho Lee
b9d18d4ac9 clientv3: add 'SetEndpoints' method 2016-09-20 04:36:01 +09:00
Anthony Romano
5e963608b7 clientv3: do not treat Internal codes as halting
Fixes #6277
2016-08-28 20:20:22 -07:00
Anthony Romano
267063efd0 clientv3: use grpc codes to translate raw grpc errors 2016-08-26 09:22:09 -07:00
Anthony Romano
3eadf964f4 clientv3: use failfast and retry wrappers for at-most-once rpcs 2016-08-16 10:49:50 -07:00