217 Commits

Author SHA1 Message Date
Kafuu Chino
ed10ca13f4 *: avoid closing a watch with ID 0 incorrectly
Signed-off-by: Kafuu Chino <KafuuChinoQ@gmail.com>

add test

1

1

1
2022-10-10 19:54:58 +08:00
Benjamin Wang
6958ee8ff2 Skip WatchRequestProgress test in grpc-proxy mode.
We shouldn't fail the grpc-server (completely) by a not implemented RPC.
Failing whole server by remote request is anti-pattern and security
risk.

Refer to https://github.com/etcd-io/etcd/runs/7034342964?check_suite_focus=true#step:5:2284

```
=== RUN   TestWatchRequestProgress/1-watcher
panic: not implemented
goroutine 83024 [running]:
go.etcd.io/etcd/proxy/grpcproxy.(*watchProxyStream).recvLoop(0xc009232f00, 0x4a73e1, 0xc00e2406e0)
	/home/runner/work/etcd/etcd/proxy/grpcproxy/watch.go:265 +0xbf2
go.etcd.io/etcd/proxy/grpcproxy.(*watchProxy).Watch.func1(0xc0038a3bc0, 0xc009232f00)
	/home/runner/work/etcd/etcd/proxy/grpcproxy/watch.go:125 +0x70
created by go.etcd.io/etcd/proxy/grpcproxy.(*watchProxy).Watch
	/home/runner/work/etcd/etcd/proxy/grpcproxy/watch.go:123 +0x73b
FAIL	go.etcd.io/etcd/clientv3/integration	222.813s
FAIL
```

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-06-29 05:12:43 +08:00
Benjamin Wang
1c9fa07cd7 Fix deadlock in 'go test -tags cluster_proxy -v ./integration/... ./clientv3/...'
Cherry pick https://github.com/etcd-io/etcd/pull/12319 to 3.4.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-06-28 13:44:47 +08:00
Chao Chen
dbde4f2d5e Backport-3.4 exclude alarms from health check conditionally 2021-05-04 10:37:12 -07:00
Sam Batschelet
b66c53ff5f proxy/grpcproxy: add return on error for metrics handler
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2020-03-16 12:06:01 -04:00
Gyuho Lee
5d19b96341 proxy/grpcproxy: deprecate "grpc.ErrClientConnClosing"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-05 14:38:44 -07:00
Gyuho Lee
6a0811a949 *: use new adt.IntervalTree interface
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-31 22:23:13 -07:00
Gyuho Lee
34bd797e67 *: revert module import paths
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-05-28 15:39:35 -07:00
Jingyi Hu
e1acf244c1 etcdserver: Add MemberAddAsLearner
Made changes to api/membership:

- Added MemberAddAsLearner
- Reverted changes to MemberAdd - removed input parameter isLearner
2019-05-14 18:18:10 -07:00
Jingyi Hu
2b76200f70 *: add MemberAddAsLearner to clientv3 Cluster API
Made changes to Clientv3 Cluster API:

- Added MemberAddAsLearner.
- Reverted changes to MemberAdd - removed input parameter isLearner.
2019-05-14 16:56:44 -07:00
Jingyi Hu
fc14608cb7 clientv3: support MemberAdd for learner
Added IsLearner flag to clientv3 MemberAdd API.
2019-05-14 13:10:22 -07:00
Jingyi Hu
a0d3c4d641 *: fix compilation after API change
Fixed compilation erros after API change for learner.
2019-05-14 13:10:22 -07:00
shivaramr
9150bf52d6 go modules: Fix module path version to include version number 2019-04-26 15:29:50 -07:00
Sam Batschelet
9915d02022 *: Change gRPC proxy to expose etcd server endpoint /metrics
This PR resolves an issue where the `/metrics` endpoints exposed by the proxy were not returning metrics of the etcd members servers but of the proxy itself.

Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2019-04-10 16:09:32 -04:00
Igor German
d88f686a91 grpcproxy: fix memory leak
use set instead of slice as interval value

fixes #10326
2018-12-15 17:00:51 +03:00
caoming
92cb9c3295 tcpproxy: add a test. 2018-11-15 14:28:30 +08:00
Xiang Li
ec5ff10436
Merge pull request #10019 from thrawn01/grpc-proxy-watch-errors
Improve watch error reporting when using grpc proxy
2018-09-10 12:54:33 -07:00
Gyuho Lee
07fcc26799 *: fix gofmt warnings with Go 1.11
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 21:45:24 -07:00
Gyuho Lee
0ef9ef3c74 *: rerun "gofmt"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 18:25:39 -07:00
Gyuho Lee
d37f1521b7 *: update import paths to "go.etcd.io/etcd"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 17:47:55 -07:00
Derrick J. Wippler
f0e6c10aba grpcproxy: return error to client during watch create
Now returns errors from checkPermissionForWatch() via the CancelReason
field. This allows clients to understand why the watch was canceled.
Additionally, this change protects a watch from starting and that
otherwise might hang indefinitely.
2018-08-16 23:10:02 -05:00
Gyuho Lee
42bef8460c *: clean up code format
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-07-21 16:34:56 -07:00
Gyuho Lee
d922069713 grpcproxy: fix "grpc.ErrClientConnClosing" handling
Fix

```
go test -v -tags cluster_proxy -run TestWatchErrConnClosed
```

with gRPC >= v1.10

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-06-15 14:47:11 -07:00
Gyuho Lee
1a102fb3f5 proxy/httpproxy: document histogram
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-23 14:03:28 -07:00
Gyuho Lee
041b9069a2 *: configure server logger
- Add/Document "logger" to support structured logging.
  - This makes functional tests run easier, since zap logger
    provides built-in log redirect to files.
  - "etcd --logger-option=zap" to enable structured logging.
- Current "capnslog" will still be used as "default".
  - We may switch the default or deprecate "capnslog" in v3.5.
  - Either way, will clearly be documented.

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-16 17:36:00 -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
8a518b01c4 *: revert "internal/mvcc" change
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-02-26 17:11:40 -08:00
Rob Day
dfe12ed5c2 httpproxy: cancel requests when client closes a connection 2018-02-18 19:19:44 +00:00
Gyuho Lee
80d15948bc *: move "mvcc" to "internal/mvcc"
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-26 11:14:41 -08:00
Gyuho Lee
e689ff823e proxy/grpcproxy: remove "Errors" field
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-01-17 15:58:56 -08:00
Jordan Liggitt
f77e54eb13
api/etcdhttp: change /health type back to string for backwards compatibility 2018-01-15 01:57:55 -05: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
Hitoshi Mitake
e8c18e3368 proxy: handle authed snapshot request in grpcproxy
Like the previous commit 10f783efdd12, this commit lets grpcproxy
forward an auth token supplied by its client in an explicit
manner. snapshot is a stream RPC so this process is required like
watch.
2017-09-20 15:27:27 +09:00
Hitoshi Mitake
94b5071c30 etcdmain, proxy: handle authed watch in grpcproxy
This commit lets grpcproxy handle authed watch. The main changes are:
1. forwrading a token of a new broadcast client
2. checking permission of a new client that participates to an
   existing broadcast
2017-09-20 15:27:26 +09:00
Hitoshi Mitake
e709f83253 etcdmain, proxy: support authed RPCs with grpcproxy
This commit lets grpcproxy support authed RPCs. Auth tokens supplied
by clients are now forwarded to etcdserver by grpcproxy.
2017-09-20 11:14:45 +09:00
Anthony Romano
7f4464415a grpcproxy: respect KeysOnly flag
Fixes #8478
2017-09-13 09:57:08 -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
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
Gyu-Ho Lee
f8141db2c7 proxy/grpcproxy: implement LeaseLeases API
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-08-14 14:18:56 -07:00
Anthony Romano
6a4194c556 grpcproxy: forward PrevKv flag in Put 2017-08-03 21:38:20 -07:00
Gyu-Ho Lee
cd37ef2c1b *: expose etcdhttp.Health, define proxy health handler
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-07-31 14:07:54 -07:00
Gyu-Ho Lee
8a589d2d73 grpcproxy/cluster_test: serve grpc server after register service
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-07-27 10:47:24 -07:00
Xiang Li
2a348fb8e9 Merge pull request #8263 from fanminshi/hash_by_rev
api: hash by rev
2017-07-26 11:22:33 -07:00
fanmin shi
a6ae677d8f proxy: support HashKV in grpcproxy 2017-07-25 17:00:56 -07:00
Anthony Romano
9581f7676c grpcproxy: forward Canceled field when broadcasting watch responses 2017-07-25 12:36:01 -07:00
Xiang Li
fe33bd1879 Merge pull request #8294 from mitake/proxy-cachemiss
proxy: don't inc a cache miss count in a case of linearizable range
2017-07-24 20:47:19 -07:00
Anthony Romano
1dcae41b20 grpcproxy: return nil on receiving snapshot EOF
Gets "code = OutOfRange desc = EOF" errors otherwise.
2017-07-21 11:00:22 -07:00
Hitoshi Mitake
488df4db34 proxy: don't inc a cache miss count in a case of linearizable range
Requests of linearizable range don't touch the cache of grpcproxy. So
incrementing the miss count wouldn't be meaningful.
2017-07-20 21:51:10 -07:00
Gyu-Ho Lee
3e263d5a4d proxy/*: add 'MoveLeader' RPC
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
2017-06-23 12:51:27 -07:00
Anthony Romano
f465e3ea8a grpcproxy: support nested txns 2017-06-21 14:33:15 -07:00