Commit Graph

40 Commits

Author SHA1 Message Date
18eb5c6881 Merge pull request #18748 from mmorel-35/golangci-lint/gofumpt
fix: enable gofumpt instead of gofmt linter in client
2024-10-25 12:25:33 +01:00
906247c8f9 fix: enable gofumpt instead of gofmt linter in client
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-10-17 22:29:59 +02:00
b281a3c4fa fix: enable errorlint in api, client and pkg
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-10-13 19:43:20 +02:00
ecc2c5e471 client modules: remaining errors.Is conversions for error equality and inequality checks.
Signed-off-by: redwrasse <mail@redwrasse.io>
2024-09-22 17:43:01 -07:00
6c98a96866 Introduce Kubernetes KV interface to etcd client
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2024-07-23 14:53:09 +02:00
281f177345 add verification on client.Sync to ensure the returned endpoints never empty
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
2024-06-24 10:07:36 +01:00
578b784dcd client: address golangci var-naming issues
Signed-off-by: Ivan Valdes <ivan@vald.es>
2024-03-14 20:47:32 -07:00
0857def30e add backoff to client config
Signed-off-by: Allen Ray <alray@redhat.com>
2024-01-24 11:08:31 -05:00
52a9b9d96c add initialization for epMu in contetx client
fixes #17001

Signed-off-by: Mofi Rahman <mofi@google.com>
2023-11-24 20:57:40 +00:00
aea1cd0077 feat: enable unparam lint
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-10-17 21:24:13 +08:00
979102f895 clientv3: remove the experimental gRPC API grpccredentials.Bundle
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-08-02 19:35:51 +01:00
c023c06903 checks the client supported versions based on the current version
Signed-off-by: caojiamingalan <alan.c.19971111@gmail.com>
2023-07-27 19:42:02 -05:00
9e1abbab6e Fix goimports in all existing files. Execution of ./scripts/fix.sh
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-29 09:41:31 +01:00
bf5c936ff1 Merge pull request #14731 from ramil600/grpc_withinsecure
client/v3: replace deprecated grpc.WithInsecure()  issue #14732
2022-11-16 06:41:29 +08:00
95c520976a client: Use func without format
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-15 01:02:24 +03:00
44d8e732cf client/v3: replace deprecated grpc.WithInsecure()
Deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x.

Signed-off-by: Ramil Mirhasanov <ramil600@yahoo.com>
2022-11-11 12:08:50 +03:00
8a587447d2 clientv3: fix errors init client RejectOldCluster
Signed-off-by: happlins <happlins@foxmail.com>
2022-10-13 17:24:24 +08:00
d4778e78c8 more logging around auto sync
Signed-off-by: Chao Chen <chaochn@amazon.com>
2022-08-10 18:00:06 -07:00
0c9a4e0f93 Merge pull request #13837 from chrisayoub/main
clientv3: filter learner members during autosync
2022-04-09 19:00:55 -04:00
63346bfead server: Use default logging configuration instead of zap production one
This fixes problem where logs json changes format of timestamp.
2022-04-01 10:23:42 +02:00
125f3c3f9a clientv3: filter learners members during autosync
This change is to ensure that all members returned during the client's
AutoSync are started and are not learners, which are not valid
etcd members to make requests to.
2022-03-29 13:38:21 -04:00
17fd2e7282 Disable auth gracefully without impacting existing watchers
This attempts to fix a special case of the problem described in #12385,
where trying to do `clientv3.Watch` with an expired token would result
in `ErrGRPCPermissionDenied`, due to the failing authorization check in
`isWatchPermitted`. Furthermore, the client can't auto recover, since
`shouldRefreshToken` rightly returns false for the permission denied
error.

In this case, we would like to have a runbook to dynamically disable
auth, without causing any disruption. Doing so would immediately expire
all existing tokens, which would then cause the behavior described
above. This means existing watchers would still work for a period of
time after disabling auth, until they have to reconnect, e.g. due to a
rolling restart of server nodes.

This commit adds a client-side fix and a server-side fix, either of
which is sufficient to get the added test case to pass. Note that it is
an e2e test case instead of an integration one, as the reconnect only
happens if the server node is stopped via SIGINT or SIGTERM.

A generic fix for the problem described in #12385 would be better, as
that shall also fix this special case. However, the fix would likely be
a lot more involved, as some untangling of authn/authz is required.
2021-12-31 14:39:46 +07:00
c929a917b6 client: Use first endpoint as http2 authority header 2021-09-29 14:41:35 +02:00
77a5072b69 client: call .Endpoints() in dial() in client/v3/client.go instead of accessing cfg.Endpoints directly
0cdd558361/client/v3/client.go (L299) accesses
endpoints without acquiring lock. Fix it to call Endpoints()

Fix #13201
2021-07-27 15:55:22 -07:00
7271adecc5 Merge pull request #12992 from awly/client-auth-bundle-overwrite
client/v3: do not overwrite authTokenBundle on dial
2021-07-01 10:40:18 +02:00
ab8e5a4f8e client/v3: do not overwrite authTokenBundle on dial
`Client.dial` can be called multiple times. For example, from regular
`NewClient` and [from the `Maintenance`
wrapper](6d451ab61d/client/v3/maintenance.go (L81-L84)).

This ends up creating two (if `Client.dial` is called twice) independent
`credentials.Bundle` instances:
- the first one is wired into `PerRPCCredentials` callback in gRPC
  client.
- the second one is in `Client.authTokenBundle` and receives the latest
  auth token updates.

When using username/password authentication and the server is configured
to issue JWTs, token rotation logic breaks because of the above
`credentials.Bundle` confusion.
2021-06-23 09:44:27 -07:00
bda32db121 Expose clientv3.CreateDefaultZapLoggerConfig
Need raised in
f3f4259d3f.

BTW: Alligned the implementation of grpclogs with what we use in embed
server, so reduced the client code dependencies.
2021-05-25 22:59:08 +02:00
1189ee3f3d client: Add logger argument to NewCtxClient 2021-05-12 16:40:55 +02:00
06afe87b34 client: Allow setting zap logger in config 2021-05-12 12:15:20 +02:00
bc8d3f6639 Clientv3 (retry) logs should use the configured logger.
clientv3 logs (especially tests) were poluted with unattributed to testing.T log lines:

```
{"level":"warn","ts":"2021-04-29T12:42:11.055+0200","logger":"etcd-client","caller":"v3/retry_interceptor.go:64","msg":"retrying of unary invoker failed","target":"etcd-endpoints://0xc0000fafc0/#initially=[unix://localhost:m10]","attempt":0,"error":"rpc error: code = ResourceExhausted desc = etcdserver: mvcc: database space exceeded"}
```

The reasons were 2 fold:
  - Interceptors were copying logger before "WithLogger" could modify it.
  - We were not propagating the loggers in a few testing contexts.
2021-04-29 12:57:09 +02:00
18321a0c85 Merge pull request #12786 from ptabor/20210318-debug-env
client: Bring back ETCD_CLIENT_DEBUG variable interpretation.
2021-03-18 21:55:51 +01:00
9312d1b077 clientv3: Bring back ETCD_CLIENT_DEBUG variable interpretation.
env ETCD_CLIENT_DEBUG supports log levels (debug, info, warn, error, dpanic, panic, fatal).
Only when set, overrides application-wide grpc logging settings.
2021-03-18 18:43:07 +01:00
dac6e37ea1 *: over 20 staticcheck fixes 2021-03-18 15:06:17 +01:00
2c2456bf3d *: partial staticcheck fix 2021-03-10 14:13:38 +00:00
4a1c24556c clientv3: PS: Replace balancer with upstream grpc solution
Addresses comments from: https://github.com/etcd-io/etcd/pull/12671#pullrequestreview-593942302
2021-02-23 10:03:15 +01:00
b67ed4e4aa Merge pull request #12671 from ptabor/20210207-grpc-del-balancer
clientv3: Replace balancer with upstream grpc solution
2021-02-17 22:45:13 +01:00
0b75fede64 Replace client/v3/balancer with standard components: resolver + round_robin LB
This commit significantly reduces volume of custom code
in etcd client v3, while preserving full existing functionality.
2021-02-08 18:50:31 +01:00
8feb55f65c *: implement Endpoint Watch and new Resolver 2021-02-08 20:05:45 +08:00
e33c6dd9df client/v3: Rename of imports 2020-10-20 10:13:06 +02:00
8a7f15511c clientv3: Move to client/v3 (just file move)
Mechanical:
% git mv clientv3 client/v3
% git mv client/mock client/v3/
2020-10-20 10:08:35 +02:00