46 Commits

Author SHA1 Message Date
Benjamin Wang
09f7d7ab92
Merge pull request #17875 from ivanvc/fix-deprecation-comments-added-with-var-naming-lint-rule
Fix deprecation comments from addressing var-naming work
2024-04-30 19:51:37 +01:00
Jes Cok
dafadd13c1 all: don't convert byte slice to string when using verb %s
This is unnecessary, as the documentation for 'go doc fmt' says:
%s the uninterpreted bytes of the string or slice

Signed-off-by: Jes Cok <xigua67damn@gmail.com>
2024-04-25 23:34:52 +08:00
Ivan Valdes
242f5d60a8
Fix deprecation comments from addressing var-naming work
The deprecation tag/comment must to be followed by an empty line.

Signed-off-by: Ivan Valdes <ivan@vald.es>
2024-04-24 14:40:59 -07:00
Jes Cok
bc31162cc2 all: call Close() after reading http.Response.Body
As the doc of http.Response.Body says:

// The http Client and Transport guarantee that Body is always
// non-nil, even on responses without a body or responses with
// a zero-length body. It is the caller's responsibility to
// close Body.

Signed-off-by: Jes Cok <xigua67damn@gmail.com>
2024-03-25 12:17:47 +08:00
Ivan Valdes
c613b78e6c
etcdserver: address golangci var-naming issues
Signed-off-by: Ivan Valdes <ivan@vald.es>
2024-03-18 17:17:07 -07:00
Siyuan Zhang
12b640523a etcdserver: add linearizable_read check to readyz.
Signed-off-by: Siyuan Zhang <sizhang@google.com>
2023-11-21 11:13:20 -08:00
Siyuan Zhang
3897103b77 etcdserver: add metric counters for livez/readyz health checks.
Signed-off-by: Siyuan Zhang <sizhang@google.com>
2023-11-14 09:26:00 -08:00
Siyuan Zhang
7a57e06eca etcdserver: add livez and ready http endpoints for etcd.
Add two separate probes, one for liveness and one for readiness. The liveness probe would check that the local individual node is up and running, or else restart the node, while the readiness probe would check that the cluster is ready to serve traffic. This would make etcd health-check fully Kubernetes API complient.

Signed-off-by: Siyuan Zhang <sizhang@google.com>
2023-10-14 22:32:16 -07:00
Eng Zer Jun
867faa1924
etcdserver: remove redundant len check in health check
From the Go specification [1]:

  "1. For a nil slice, the number of iterations is 0."

`len` returns 0 if the slice or map is nil [2]. Therefore, checking
`len(v) > 0` around a loop is unnecessary.

[1]: https://go.dev/ref/spec#For_range
[2]: https://pkg.go.dev/builtin#len

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-10-13 18:39:38 +08:00
Chao Chen
c25f1dff82 http health check bug fixes
Signed-off-by: Chao Chen <chaochn@amazon.com>
2023-10-12 16:59:34 -07:00
Wei Fu
4704a5af3a *: fix unused issue
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-09-25 19:37:18 +08:00
Wei Fu
896d161d16 *: fix stylecheck linter
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-09-25 19:14:01 +08:00
Wei Fu
aa97484166 *: enable goimports in verify-lint
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-09-21 21:14:09 +08:00
xin.li
b17b9c1428 chore: Use http constants to replace numbers as parameters
Signed-off-by: xin.li <xin.li@daocloud.io>
2023-02-20 11:53:41 +08:00
Piotr Tabor
9abc895122 Goimports: Apply automated fixing to test files as well.
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-29 13:04:45 +01:00
Piotr Tabor
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
Benjamin Wang
faff80a2b3 etcdserve: format the source code
gofmt -w ./server

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 13:00:59 +08:00
Benjamin Wang
e9aa275b36 etcdserver: update etcdserver to use the new raft module go.etcd.io/raft/v3
Just replaced all go.etcd.io/etcd/raft/v3 with go.etcd.io/raft/v3
under directory server.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 09:33:45 +08:00
Andrew Sims
f656fa0f49 add missing copyright headers
Signed-off-by: Andrew Sims <andrew.cameron.sims@gmail.com>
2022-11-23 19:13:43 +11:00
Sasha Melentyev
2c9c209eb6 all: Changing Printf and friends to Print if there is no formatting
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-15 22:11:23 +03:00
demoManito
a9c3d56508 etcd: remove redundant type conversion
Signed-off-by: demoManito <1430482733@qq.com>
2022-09-20 11:26:02 +08:00
Piotr Tabor
5097b33ab9 Rename etcdserver/etcderrors package to etcdserver/errors. 2022-05-20 14:32:04 +02:00
Piotr Tabor
fc6a6c3c27 Move etcdserver/errors.go to sepatate package to avoid cyclic dependencies. 2022-05-20 14:32:04 +02:00
ahrtr
e7f8bf7c44 enhance the /version endpoint to add storageVersion 2022-05-06 20:29:42 +08:00
Marek Siarkowicz
26f42e7a9e server: Apply review comments and split basic handler 2022-05-05 09:52:14 +02:00
Marek Siarkowicz
fb361e43f0 server: Split code for debug and version endpoints 2022-05-05 09:52:14 +02:00
Marek Siarkowicz
722ec487df server: Split metrics and health code 2022-05-05 09:52:14 +02:00
Marek Siarkowicz
600ee13ac0 server: Cover V3 health with tests 2022-05-05 09:52:14 +02:00
Marek Siarkowicz
e9dec74ded server: Refactor health checks 2022-05-05 09:52:14 +02:00
Marek Siarkowicz
191aed645e server: Run health check tests in subtests 2022-05-05 09:52:14 +02:00
Marek Siarkowicz
e4e391792a server: Rename test case expect fields 2022-05-05 09:52:13 +02:00
Marek Siarkowicz
0fb194d6f2 server: Use named struct initialization in healthcheck test 2022-05-05 09:52:13 +02:00
Marek Siarkowicz
0096d2ecdb server: Remove unused NewClientHandler 2022-05-05 09:52:13 +02:00
Marek Siarkowicz
804fddf921 tests: Use zaptest.NewLogger in tests 2022-04-04 13:03:15 +02:00
Marek Siarkowicz
692b3c4cd7 server: Remove most of V2 API 2022-01-25 15:24:13 +01:00
ahrtr
09ff05108b enhance health check endpoint to support serializable request 2021-11-15 05:57:54 +08:00
Chao Chen
f6f27d32d1 server/etcdserver/api/etcdhttp: exclude the same alarm type activated by multiple peers 2021-11-09 11:33:59 -08:00
Eng Zer Jun
2a151c8982
*: move from io/ioutil to io and os packages
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-10-28 00:05:28 +08:00
ahrtr
d38c383c0d etcdserver: skip empty alarm from the query parameter 2021-07-05 23:54:49 +08:00
tangcong
dd62aebfb5 fix health endpoint not usable when authentication is enabled 2021-06-25 14:02:45 +08:00
Chao Chen
140ea4fa29 etcdhttp/metrics.go: exclude alarms from health check conditionally with ?exclude=NOSPACE 2021-04-20 13:17:09 -07:00
Piotr Tabor
3bb7acc8cf Migrate dependencies pkg/foo -> client/pkg/foo 2021-04-07 00:38:47 +02:00
Chao Chen
2ae3e82f07 etcdserver/api/etcdhttp: log successful etcd server side health check in debug level
When we have an external component that checks /health periodically, the
etcd server logs can be quite verbose (e.g., DDOS-ing against insure
etcd health check can lead to disk space full due to large log files).

This change was introduced in #11704.

While we keep the warning logs for etcd health check failures, the
success (or OK) log level should be set to DEBUG.

Fixes #12676
2021-02-08 17:15:43 -08:00
Yanhao Mo
6d82778a4e etcdserver: export method EtcdServer.leaderChangedNotify (#12378) 2021-02-02 18:13:32 +08:00
Piotr Tabor
aaf423e962 server: Update imports.
find -name '*.go' | xargs sed -i --follow-symlinks 's|etcd/v3/|etcd/server/v3/|g'
2020-10-26 13:02:32 +01:00
Piotr Tabor
4a5e9d1261 server: Move server files to 'server' directory.
26  git mv mvcc wal auth etcdserver etcdmain proxy embed/ lease/ server
   36  git mv go.mod go.sum server
2020-10-26 12:57:19 +01:00