Commit Graph

751 Commits (6f2a5b710fc13fb427128d09939671560edf680b)

Author SHA1 Message Date
Piotr Tabor f75549d53b
Merge pull request #13571 from yank1/update-cobra-version
Update Cobra version to 1.2.1
2022-01-14 14:54:28 +01:00
Michael Hoffmann 357006172d
ctlv3: add forgotten member promote method to printerRPC
The printerRPC struct was missing a MemberPromote method, leading to
panic in ectdctl when trying to print it as JSON. This PR fixes that
panic.
2022-01-14 12:53:09 +01:00
Manuel Rüger cf7e8b3535 go.mod: Bump golang.org/x/net dependency; regenerate go.sum
Bumps golang.org/x/net dependency due to fix CVE-2021-44716
as requested in https://github.com/etcd-io/etcd/pull/13487#issuecomment-997065540

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
2022-01-12 03:00:08 +01:00
Your Name 77bf0a5a9e update cobra version to 1.2.1
Signed-off-by: yankay <kay.yan@daocloud.io>
2021-12-29 17:35:25 +08:00
ahrtr 661e0a91ef added a new flag --rev to make-mirror command to support incremental mirror 2021-12-22 16:59:44 +08:00
ahrtr 8b3405bdb8 etcdctl: enhance the make-mirror command to return error asap with wrong command line parameters 2021-11-30 06:26:11 +08:00
Kushal Pisavadia 71493bde3e *: Upgrade to use go.opentelemetry.io/otel@v1.2.0
Upgrading from v1.0.1.

Upgrading related dependencies
------------------------------

The following dependencies also had to be upgraded:

- go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.26.1
  From v0.25.0. This gets rid of a transitive dependency on go.opentelemetry.io/otel@v1.0.1.
- google.golang.org/genproto@v0.0.0-20211118181313-81c1377c94b1
2021-11-24 16:03:33 +00:00
Sahdev Zala 7e0248b367
Merge pull request #13461 from qsyqian/etcdctl-command-defrag
etcdctl/ctlv3/command: add use time for defrag command
2021-11-17 13:36:23 -05:00
qsyqian eccabd237b etcdctl/ctlv3/command: add use time for defrag command 2021-11-16 22:39:31 +08:00
Chao Chen b5e4c2d3c4 client/v2: remove unsafe json-iterator/reflect2 2021-11-09 11:16:40 -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
Lili Cosic e6e279a14d *: Bump go to go v1.17.2 2021-10-27 13:44:54 +02:00
Vladimir Ermakov 49a8aa7f49
run fix.sh
To fix dependencies.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
2021-10-13 14:08:27 +03:00
Marek Siarkowicz 1b4e54c238 api: Annotate proto messages and use it to detect etcd version that generated wal
Co-authored-by: Lili Cosic <cosiclili@gmail.com>
2021-08-04 13:36:08 +02:00
Haimantika Mitra c10d50c4b3 Replace github.com/form3tech-oss/jwt-go with https://github.com/golang-jwt/jwt
Signed-off-by: Haimantika Mitra <haimantikamitra@gmail.com>

Made required adjustments to the go.sum file

Signed-off-by: Haimantika Mitra <haimantikamitra@gmail.com>

Changed go.sum file in the server directory

Signed-off-by: Haimantika Mitra <haimantikamitra@gmail.com>

Removed the white space

Signed-off-by: Haimantika Mitra <haimantikamitra@gmail.com>

Made required changes

Signed-off-by: Haimantika Mitra <haimantikamitra@gmail.com>

Trying to fix the fails

Signed-off-by: haimantika mitra <haimantikamitra@gmail.com>

Removed error

Signed-off-by: haimantika mitra <haimantikamitra@gmail.com>

Fixed bill-of-materials.json file

Signed-off-by: haimantika mitra <haimantikamitra@gmail.com>

Changed go.mod with recent version

Signed-off-by: haimantika mitra <haimantikamitra@gmail.com>

Newer version changes

Signed-off-by: haimantika mitra <haimantikamitra@gmail.com>

Changes to etcdutl directory

Signed-off-by: haimantika mitra <haimantikamitra@gmail.com>
2021-08-03 13:49:47 +05:30
yuzhiquan 2a5dd39d79 invaild args 2021-07-28 11:39:54 +08:00
Piotr Tabor 8f9829cd2d
Merge pull request #13114 from lilic/fix-api-version
Bump etcd version to 3.5.0 and 3.6.0-pre
2021-06-24 14:26:17 +02:00
Mario Valderrama 6eabc41aee etcdctl: add command to generate shell completion
To improve the UX of etcdctl. Completion is generated by cobra
according to defined commands and flags.

Fixes #13111
2021-06-22 13:29:23 +02:00
Lili Cosic df696a7e76 go.mod: Bump etcd to 3.5.0 2021-06-22 12:25:39 +02:00
Piotr Tabor 5564476831
Merge pull request #13073 from serathius/snapshot-version
[Version in Snapshot] SnapshotResponse includes local etcd version
2021-06-21 16:56:00 +02:00
Marek Siarkowicz e1b1d93548 *: Snapshot returns local etcd version
Co-authored-by: Lili Cosic <cosiclili@gmail.com>
2021-06-14 16:36:50 +02:00
Lili Cosic 16477a8270 Update client_golang dependency to v1.11.0 2021-06-07 14:49:57 +02:00
Piotr Tabor 404efd70f7 Upgrade of prometheous deps.
For now we need to depend on unstable: prometheus/client_golang
2021-06-03 16:07:01 +02:00
Piotr Tabor edcfe575cf Update dependencies:
- github.com/coreos/go-systemd/v22 v22.3.2
  - github.com/google/btree v1.0.1
  - github.com/json-iterator/go v1.1.11
  - github.com/mattn/go-runewidth v0.0.13
  - github.com/prometheus/client_golang v1.10.0
  - github.com/prometheus/common v0.26.0
  - github.com/sirupsen/logrus v1.8.1
2021-06-03 13:03:01 +02:00
Piotr Tabor b240625d21 Update bbolt to v1.3.6.
`./scripts/update_dep.sh go.etcd.io/bbolt v1.3.6`
2021-06-03 12:39:53 +02:00
Piotr Tabor 90cea7d4e7 Update zap to v1.17.0. 2021-06-03 12:37:43 +02:00
Piotr Tabor 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
赵延 64b01a7a8d
Enhance the root permission, when root role exist, it always return rootPerm. (#13006)
etcdctl role grant-permission root readwrite foo.
see etcdctl role get root output.
Before:
Role root
KV Read:
        foo
KV Write:
        foo
After:
Role root
KV Read:
        [, <open ended>
KV Write:
        [, <open ended>
2021-05-24 14:58:00 -07:00
Pavan BG d9c5e1f0a2 *: Replace internal testutil AssertEqual function in favour of github.com/stretchr/testify/assert.Equals
To maintain uniformity in testing methodology, assert.Equals has been used everywhere while replacing testutil.AssertEqual

Fixes #13015
2021-05-20 19:55:45 +05:30
horizonzy 6ab56fc237 enhance GetRole output when role is 'root' and the response perm is nil.
Before output:
Role root
KV Read:
KV Write:

After output:
Role root
KV Read:
	[, <open ended>
KV Write:
	[, <open ended>
2021-05-19 17:35:13 +08:00
Piotr Tabor 3f7a038656 Fixed documentation and scripts. 2021-05-17 11:54:03 +02:00
Piotr Tabor c09aca1ba4 Split etcdctl into etcdctl (public API access) & etcdutl (direct surgery on files)
Motivation is as follows:

  - etcdctl we only depend on clientv3 APIs, no dependencies of bolt, backend, mvcc, file-layout
  - etcdctl can be officially supported across wide range of versions, while etcdutl is pretty specific to file format at particular version.
it's step towards desired modules layout, documented in: https://etcd.io/docs/next/dev-internal/modules/
2021-05-17 11:54:03 +02:00
Piotr Tabor 3ed0cb1dfc
Update modules to more stable versions. (#12975) 2021-05-15 23:32:27 -07:00
Piotr Tabor 00c6090110 Refactor common code from etcdctl (v2,v3) to pkg/corbautl.
Preparation for etcdutl split.
2021-05-14 14:16:53 +02:00
Piotr Tabor ab586cd463 Persists Term in the (bbolt) Backend.
Additional layer of protection, that allows to validate whether we
start replaying log not only from the proper 'index', but also of the
right 'term'.
2021-05-13 21:29:01 +02:00
Gyuho Lee e2d67f2e3b
Merge pull request #12956 from gyuho/rename-to-main
*: rename "master" branch references to "main" in source code
2021-05-13 08:26:33 -07:00
Sahdev Zala 5f76adfc3e doc: fix output flag format
Add missing dash in the flag.
2021-05-12 14:13:08 -04:00
Gyuho Lee a8e1cf0433 client: rename "master" branch references to "main"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2021-05-12 10:38:50 -07:00
Marek Siarkowicz 06afe87b34 client: Allow setting zap logger in config 2021-05-12 12:15:20 +02:00
Lili Cosic 1a718a958e Add initial Tracing with OpenTelemetry 2021-05-10 10:44:40 +02:00
Piotr Tabor aeb9b5fc73
Merge pull request #12855 from ptabor/20210409-backend-hooks
(no)StoreV2 (Part 4): Backend hooks:  precommit updates consistency_index
2021-05-08 09:34:31 +02:00
Sam Batschelet 82b2d5c67d server: add support for log rotation
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2021-05-07 08:39:51 -04:00
Piotr Tabor f1123d696c fixup! Unify shared code (and constants) with cindex package. 2021-05-04 18:21:24 +02:00
Piotr Tabor a78d072b9a Simplify KVstore dependency on cindex. 2021-05-04 18:21:24 +02:00
Piotr Tabor 451f65d661
Merge pull request #12908 from ptabor/20210429-client-retry-logging
Clientv3 (retry interceptor) logs should use the configured logger
2021-04-29 19:25:04 +02:00
Piotr Tabor cedbea6c81
Merge pull request #12904 from wpedrak/limit_mlocked_memory
server: replace mlockall with `Mlock` in `--experimental-memory-mlock`
2021-04-29 18:21:24 +02:00
Piotr Tabor ffea1537d4 ClientV3 tests use integration.NewClient that configures proper logger. 2021-04-29 18:18:34 +02:00
Piotr Tabor 835643e6e2
Merge pull request #12906 from ptabor/20210429-etcdctl-v2-backup-cindex-fix
20210429 etcdctl v2 backup cindex fix
2021-04-29 18:01:45 +02:00
Piotr Tabor e908ef3da9
Merge pull request #12903 from lilic/exit-on-signal-int
etcdctl/ctlv3: Cleanup keys on signal interrupt.
2021-04-29 16:22:41 +02:00
Piotr Tabor 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
Lili Cosic 586b2383f4 etcdctl/ctlv3: Cleanup keys on signal interrupt of check perf
If ctc+c is pressed during the run of etcdctl check perf,
this deletes all the previously created keys that perf check created.
2021-04-29 12:55:36 +02:00
wpedrak 927b3a3152 server: replace mlockall with `Mlock` in `--experimental-memory-mlock`
Implementation of `--experimental-memory-mlock` backed by `mlockall` syscall is replaced by `Mlock` flag (backed by mlock syscall) of bboltDB.
2021-04-29 12:08:20 +02:00
Piotr Tabor e90504fe62 Unify shared code (and constants) with cindex package. 2021-04-29 11:51:25 +02:00
Piotr Tabor 911204cd76 Fix `ETCDCTL_API=2 etcdctl backup --with-v3` consistent index consistency
Prior to this CL, `ETCDCTL_API=2 etcdctl backup --with-v3` was readacting WAL log
(by removal of some entries), but was NOT updating consistent_index in the backend.
Also the WAL editing logic was buggy, as it didn't took in consideration the fact
that when TERM changes, there can be entries with duplicated indexes in
the log. So its NOT sufficient to subtract number of removed entries to
get accurate log indexes.

The PR replaces removing and shifting of WAL entries with replacing them with an no-op entries.
Thanks to this consistent-index references are staying up to date.

The PR also:
  - updates 'verification' logic to check whether consistent_index does not lag befor last snapshot
  - env-gated execution of verification framework in `etcdctl backup`.

Tested with:
```
(./build.sh && cd tests && EXPECT_DEBUG=TRUE 'env' 'go' 'test' '-timeout=300m' 'go.etcd.io/etcd/tests/v3/e2e' -run=TestCtlV2Backup --count=1000 2>&1 | tee TestCtlV2BackupV3.log)
```
2021-04-29 11:51:24 +02:00
Piotr Tabor adc365e14f etcdctl2: backup command logging cleanup (zap) 2021-04-28 23:26:17 +02:00
Piotr Tabor 7107cb9f86 fixup! Create 'datadir' package responsible for paths. 2021-04-28 08:44:06 +02:00
Piotr Tabor c4b13a5c83 Integrate verification framework
Verification framework is integrated with:
  - integration tests (by default)
  - `ETCD_VERIFY=all etcdctl snapshot restore` command
  - etcd shutdown when running with `ETCD_VERIFY=all` env.
2021-04-28 07:56:16 +02:00
Piotr Tabor 6f8f506cf4 Create 'datadir' package responsible for paths. 2021-04-28 07:56:13 +02:00
Piotr Tabor 067521981e v2 etcdctl backup: producing consistent state of membership 2021-04-27 19:34:34 +02:00
Piotr Tabor a70386a1a4 Simplify membership interface: Does not pass the 'unused' token. 2021-04-27 17:17:31 +02:00
Piotr Tabor 768da490ed sever: v2store deprecation: Fix `etcdctl snapshot restore` to restore
correct 'backend' (bbolt) context in aspect of membership.

Prior to this change the 'restored' backend used to still contain:
  - old memberid (mvcc deletion used, why the membership is in bolt
bucket, but not mvcc part):
    ```
	mvs := mvcc.NewStore(s.lg, be, lessor, ci, mvcc.StoreConfig{CompactionBatchLimit: math.MaxInt32})
	defer mvs.Close()
	txn := mvs.Write(traceutil.TODO())
	btx := be.BatchTx()
	del := func(k, v []byte) error {
		txn.DeleteRange(k, nil)
		return nil
	}

	// delete stored members from old cluster since using new members
	btx.UnsafeForEach([]byte("members"), del)
    ```
  - didn't get new members added.
2021-04-27 17:17:30 +02:00
Piotr Tabor ea287dd9f8
Merge pull request #12854 from ptabor/20210410-shouldApplyV3
(no)StoreV2 (Part 3): Applying consistency fix: ClusterVersionSet (and co) might get not applied on v2store
2021-04-21 09:31:38 +02:00
Piotr Tabor 11249fdee9
Merge pull request #12874 from ptabor/20210417-go1.16.3
Update go for 3.5: 1.15.x -> 1.16.3
2021-04-19 16:51:49 +02:00
Piotr Tabor 3423a949c0 Update go for 3.5: 1.15 -> 1.16.(3).
https://github.com/etcd-io/etcd/issues/12732
2021-04-19 16:50:54 +02:00
Piotr Tabor 2f77a1ac67
Merge pull request #12864 from ssbostan/master
client: fix check datascale command for https endpoints
2021-04-18 17:44:07 +02:00
Saeid Bostandoust 97a8affdd3 fix util.go file 2021-04-17 14:24:56 +04:30
Saeid Bostandoust a9c4301c1e fix check datascale command for https endpoints 2021-04-16 03:51:04 +04:30
Piotr Tabor eafbc8c57e Update zap logging dependency.
In particular bring up zapgrpc V2 code:
89e382035d
https://pkg.go.dev/google.golang.org/grpc/grpclog#LoggerV2
2021-04-14 12:15:48 +02:00
Piotr Tabor b1c04ce043 Applying consistency fix: ClusterVersionSet (and co) might get no applied on v2store
ClusterVersionSet, ClusterMemberAttrSet, DowngradeInfoSet functions are
writing both to V2store and backend. Prior this CL there were
in a branch not executed if shouldApplyV3 was false,
e.g. during restore when Backend is up-to-date (has high
consistency-index) while v2store requires replay from WAL log.

The most serious consequence of this bug was that v2store after restore
could have different index (revision) than the same exact store before restore,
so potentially different content between replicas.

Also this change is supressing double-applying of Membership
(ClusterConfig) changes on Backend (store v3) - that lackilly are not
part of MVCC/KeyValue store, so they didn't caused Revisions to be
bumped.

Inspired by jingyih@ comment:
https://github.com/etcd-io/etcd/pull/12820#issuecomment-815299406
2021-04-12 09:43:48 +02:00
Piotr Tabor 931af493cf Merge pull request #12830 from ptabor/20210405-split-pkg
Split client/pkg as dedicated low-dependencies module for client
2021-04-08 01:12:17 +02:00
Piotr Tabor 3bb7acc8cf Migrate dependencies pkg/foo -> client/pkg/foo 2021-04-07 00:38:47 +02:00
garenchan c047ed593c etcdctl: lock return exit code of exec-command
Sometimes we expect to get the exit code of the command being
executed.
2021-04-06 14:34:31 +08:00
Piotr Tabor f290ab2e60 Update dependecies:
github.com/grpc-ecosystem/grpc-gateway v1.14.6 -> grpc-gateway v1.16.0
  golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e->v0.0.0-20210220033141-f8bda1e9f3ba
2021-03-27 20:48:33 +01:00
Piotr Tabor c49807f59e Update cmux to 1.5.0.
Executed using:
```
./scripts/update_dep.sh github.com/soheilhy/cmux v0.1.5
```
2021-03-27 11:18:13 +01:00
Piotr Tabor 4d4c84e014 server: Written Snapshot's to WAL contains populated ConfState.
This will (among others) allow etcd-3.6 to not depend on store_v2 .snap files at all,
as WAL + db file will be self-sufficient.
2021-03-25 00:31:44 +01:00
Piotr Tabor a60676686b Update dep: grpc: 1.32.0 -> 1.36.0. 2021-03-24 22:27:55 +01:00
Piotr Tabor 45fb7b41d6 Update dep: github.com/golang/protobuf v1.3.5 ->  v1.5.1
Thanks to https://go-review.googlesource.com/c/protobuf/+/300869/ its
feasible now.
2021-03-24 22:27:12 +01:00
Piotr Tabor 8469108548
Merge pull request #12782 from ptabor/20210316-fixes
Integration: Test flakiness fixes
2021-03-19 20:10:11 +01:00
Piotr Tabor 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
Piotr Tabor a84bd093b0 Integration with grpc-settable logger. 2021-03-16 22:50:41 +01:00
Piotr Tabor 18382aa234 Fix 2 sources of leaked memory: embed server HTTP & v3_snapshot.leasser. 2021-03-16 22:20:00 +01:00
Gyuho Lee 4eba403ccc
Merge pull request #12765 from ptabor/20210312-move-config
Move config (ServerConfig) out of etcdserver package.
2021-03-11 15:05:29 -08:00
Piotr Tabor fd7fed1511 Move config (ServerConfig) out of etcdserver package.
Motivation:
  - ServerConfig is part of 'embed' public API, while etcdserver is more 'internal'
  - EtcdServer is already too big and config is pretty wide-spread leaf
if we were to split etcdserver (e.g. into pre & post-apply part).
2021-03-11 20:56:22 +01:00
Piotr Tabor b9226d03f4
Merge pull request #12763 from hexfusion/bump-proto
vendor: bump gogo/proto to v1.3.2
2021-03-11 17:59:07 +01:00
Sam Batschelet d3aa3fb486 vendor: bump gogo/proto to v1.3.2
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2021-03-11 11:27:25 -05:00
wpedrak 2c2456bf3d *: partial staticcheck fix 2021-03-10 14:13:38 +00:00
Piotr Tabor a46a358577 --experimental-memory-mlock support
The flag protects etcd memory from being swapped out to disk.
This can happen in memory constrained systems where mmaped bbolt
area is natural condidate for swapping out.

This flag should provide better tail latency on the cost of higher RSS
ram usage. If the experiment is successful, the logic should get moved
into bbolt layer, where we can protect specific bbolt instances
(e.g. avoid protecting both during defragmentation).
2021-03-07 12:32:57 +01:00
Piotr Tabor f7a2389992 Update version of certifi/gocertifi to get rid of WTF Public license
Seems old versions of https://github.com/certifi/gocertifi where
categorized as "Do What The F*ck You Want To Public License".

Update to newer version that is explicit `Mozilla Public License` 2.0 (MPL 2.0).
2021-03-04 09:48:34 +01:00
Piotr Tabor 60d5159091 version: bump up to 3.5.0-alpha.0 2021-02-24 19:55:45 +00:00
Piotr Tabor 1a9c81abda Update grpc dependency to 1.32.
Simplify grpc testing infrastructure to align with upstream changes.
2021-02-23 11:31:50 +01:00
Piotr Tabor 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
Piotr Tabor 5dcd459ae9
Merge pull request #12564 from dhermes/patch-1
Adding `clientv3` import alias to match usage in `register_test.go`.
2021-01-19 23:00:19 +01:00
Piotr Tabor 1a890a4659
Merge branch 'master' into update 2021-01-16 09:35:05 +01:00
Sahdev Zala 69e99e80fa
Merge pull request #12465 from spacewander/fdoc
chore: update the documentation link in the comment
2021-01-14 00:39:25 -05:00
Dan Lorenc 5b90402082 Switch from dgrijalva/jwt-go to form3tech-oss/jwt-go.
dgrijalva/jwt-go has been abandoned and contains several serious
security issues. Most projects are now switching to the form3tech fork.

See https://snyk.io/vuln/SNYK-GOLANG-GITHUBCOMDGRIJALVAJWTGO-596515 for
info on the issues.

Signed-off-by: Dan Lorenc <dlorenc@google.com>
2021-01-10 08:04:20 -06:00
Danny Hermes 91bdc7eb49 Putting `etcd/v3` as a `FORBIDDEN_DEPENDENCY` for `etcdctl`. 2021-01-07 08:45:24 -06:00
Danny Hermes 47dbeeb65a
Removing errant commented out `replace` line 2020-12-15 12:05:26 -06:00
spacewander 67f040f921 Update other Documentation/v2 links 2020-11-11 09:57:01 +08:00
Piotr Tabor eeafcef0d2 Use "v3.5.0-pre" to reference within-etcd modules
instead of v3.0.0-000101010000000-00000000000,
that might be misleading as we don't develop etcd v3.0.0 any longer.

This version is a virtual version and is not supposed to be tagged
within the repository. We should tag real versions like: 3.5.0-alpha.0.

Please notice that go.etcd.io/etcd/client/v2 will be versioned as `v2.305.0-pre`.
The reason is that client v2 must have v2 version. I propose a
convention to envode the major version as 100x in minor version to make
the association to the underlying repository clear, staying within v2
version family.

The change was generated using:
```
DRY_RUN=false TARGET_VERSION="v3.5.0-pre" ./scripts/release_mod.sh update_versions
```
2020-11-04 18:28:43 +01: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 6c1efd6ba5 server: Update go.mod 2020-10-26 13:02:32 +01:00
Ankur Gargi 8866d55b9b
command: Enhance health command to check if there are any active alarms (#12150) 2020-10-22 15:55:15 -07:00
Piotr Tabor 09679d29ad etcdctl: Rename of imports after making etcdctl a module.
```
find -name '*.go' | xargs sed -i --follow-symlinks 's|etcd/v3/etcdctl|etcd/etcdctl/v3|g'
```
2020-10-21 11:15:35 +02:00
Piotr Tabor df48e499ea etcdctl: Make etcdctl a module (go.mod, LICENSE) 2020-10-20 12:07:27 +02:00
Piotr Tabor e33c6dd9df client/v3: Rename of imports 2020-10-20 10:13:06 +02:00
Piotr Tabor e62417297d *: Rename of imports of raft (as its now a module)
% find -name '*.go' -o -name '*.md' -o -name '*.sh' | xargs sed -i --follow-symlinks 's|etcd/v3/raft|etcd/raft/v3|g'
2020-10-16 13:58:18 +02:00
Piotr Tabor 45e4306508 client: Move client to client/v2 as a module.
We make v2 client code a module go.etcd.io/etcd/client/v2.

Pretty mechanical change that can be summarized as:

  mkdir client/v2
  cd client/v2 && git mod init go.etcd.io/etcd/client/v2

  git mv client/*.go client/v2/
  find -name '*.go' | xargs sed -i --follow-symlinks 's|/v3/client["]|/client/v2\"|g'

  + fixing changelog, bom, go.mod etc.
2020-10-15 14:39:43 +02:00
Piotr Tabor de55bb6331 pkg: Rename imports after making 'pkg' a module
find -name '*.go' | xargs sed --follow-symlinks -i 's|go.etcd.io/etcd/v3/pkg/|go.etcd.io/etcd/pkg/v3/|g'
go fmt ./...
2020-10-13 00:09:27 +02:00
Piotr Tabor 30811a06aa etcdctl, clientv3/snapshot: snapshot (Restore,Status) code out of client
"snapshot" Restore/Status code was the only remaining dependency of client on 'server'
code. The code is solelly used by etcdctl. Long-term the snapshot code
should be migrated to 'etcdadm' style of tool such that we can
distinguish tool solelly depending on networking API vs. tools that
operation on etcd files directly.

We left snapshot.Save() code in clientv3.snapshot package, such that
clients can benefits from automated download&safe to file snapshot
functionality over the wire.
2020-10-10 14:14:57 +02:00
Piotr Tabor 28f2b07623 *: Update references to code moved to the api/ dir.
Follow up to file-moves done in the previous commit.

The commit contains purely mechanical consequences of execution (apart
of scripts/genproto.sh):

  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/etcdserver/api/v3rpc/rpctypes|v3/api/v3rpc/rpctypes|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/version|v3/api/version|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/mvcc/mvccpb|v3/api/mvccpb|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/etcdserver/etcdserverpb|v3/api/etcdserverpb|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/etcdserver/api/membership/membershippb|v3/api/membershippb|g'
  % find ./ -name '*.go'  | xargs sed --follow-symlinks -i 's|v3/auth/authpb|v3/api/authpb|g'

  % find ./ -name '*.proto' -o -name '*.md'  | xargs -L 1 sed --follow-symlinks -i 's|/mvcc/mvccpb/kv.proto|/api/mvccpb/kv.proto|g'
  % find ./ -name '*.proto' -o -name '*.md'  | xargs -L 1 sed --follow-symlinks -i 's|/auth/authpb/auth.proto|/api/authpb/auth.proto|g'
  % find ./ -name '*.proto' -o -name '*.md'  | xargs -L 1 sed --follow-symlinks -i 's|/etcdserver/api/membership/membershippb/membership.proto|/api/membershippb/membership.proto|g'

  I also modified manually paths in scripts/genproto.sh.

  % go fmt ./...
2020-10-06 11:56:16 +02:00
Piotr Tabor 7c880e5263 etcdctl: Rename Start / StartWithErrors to MustStart 2020-09-09 19:32:50 +02:00
Piotr Tabor c32180d772 tests/e2e,etcdctl,etcdmain: Fix go test --tags cov -v ./tests/e2e
This CL fixes:
  COVERDIR=./coverage PASSES="build_cov" && go test --tags cov -v ./tests/e2e
and is part of the effort to make:
  COVERDIR=coverage PASSES="build_cov cov" ./test
fully pass.

The args passed to ./bin/etcd_test and ./bin/etcdctl_test binaries were
mismatched. The protocol of passing the arguments using
environment variables has been replaces with proper passing of flags.

How the measurement of coverage by e2e tests works:
  1. COVERDIR=./coverage PASSES="build_cov" are generating
./bin/etcd_test and ./bin/etcdctl_test binaries.

  2. These binaries are tests (as coverage can be computed only for
tests) [see ./main_test.go ./etcdctl/main_test.go], but this tests are
running the main logic of the server and uppon termination (or SIGTERM
signal) are writting proper .coverprofile files in the $COVERDIR folder.
The binaries used to take arguments using env variables, but its not
needed any longer. The binaries can consume any command line arguments
that either test (so --test.fooo) or the original binary can consume.

 3.  The tests/e2e (when compiled with the --tags cov) are starting the
_test binaries instead of the original binaries, such that the coverage
is being collected.
2020-09-09 12:56:15 +02:00
tangcong c667c14d8d
fix memberList inconsistent output (#11812)
* etcdctl/ctlv3: support to print memberlist in hex format json

* e2e: add memberListWithHexTest

* CHANGELOG: update for #11812
2020-05-11 00:11:40 -07:00
Hitoshi Mitake c92691dc47 etcdctl, etcdmain: warn about --insecure-skip-tls-verify options 2020-05-03 17:17:30 +09:00
Brandon Philips 96cce208c2 go.mod: use go.etcd.io/etcd/v3 versioning
This change makes the etcd package compatible with the existing Go
ecosystem for module versioning.

Used this tool to update package imports:
  https://github.com/KSubedi/gomove
2020-04-28 00:57:35 +00:00
mlmhl aa7b056a77 etcdctl: support query count only of specified prefix 2020-04-02 11:04:26 +08:00
shawwang 15eeb2c4ae etcdserver: add auth revision to AuthStatus to improve observability and testability 2020-03-04 22:37:24 +08:00
jingyih 8f5ce68adb etcdctl: fix member add command
Use members information from member add response, which is
guaranteed to be up to date.
2020-02-19 00:12:15 -08:00
Jingyi Hu ae983523db
pkg: remove capnslog (#11616)
* pkg: remove capnslog

* CHANGELOG: function signature change
2020-02-12 11:15:41 -08:00
Sahdev P. Zala acb33a5f3f etcdctl: use appropriate type conversion
index variable is being passed as uint64 so we shouldn't use Int.
Also the if loop is redundant so remove it.
2020-02-08 22:01:20 -05:00
Vern Burton 071e70cdc4
*: add a new API and command for checking auth status (#11536)
This changes have started at etcdctl under auth.go, and make changes to stub out everything down into the internal raft.  Made changes to the .proto files and regenerated them so that the local version would build successfully.
2020-02-05 19:27:42 -08:00
Jingyi Hu c0de070527 etcdctl: support progress notify option
Add support for progress notify option to etcdctl watch command.
2019-12-17 14:16:42 -08:00
schlitzered d4d7ad3908 mirror: make etcdctl make-mirror subcommand accept --dest-user and --dest-password (#11384) 2019-12-04 14:06:49 -08:00
Jonathan Calvert e48ad568b9 etcdctl: Print healthy results to stdout, not stderr
Printing to stderr when there is no actual error is not intuitive
and makes tool integration more difficult
2019-10-31 10:01:03 -05:00
Sahdev P. Zala 9002c1951f doc: add lease time
The current lease time is short and as such can lead to a timeout
error as explained in the related issue which can be confusing.

Fixes #9726
2019-10-13 16:38:28 -04:00
Jingyi Hu a5abf91771 etcdctl: fix member add command 2019-10-02 17:43:32 -07:00
Sahdev P. Zala 55b37261bc ETCDCTL_README: clarify the usage of ETCDCTL_* variables
fixes # 10840
2019-09-09 16:31:32 -04:00
Gyuho Lee ea45cd61d0
Merge pull request #10788 from jingyih/add_missing_newline_EndpointHealth
ctlv3: add newline in EndpointHealth output
2019-06-05 02:19:54 -07:00
Jingyi Hu 17e10fe13f ctlv3: add missing newline in EndpointHealth
To make the output consistent with the output before #9540.
2019-06-04 15:52:29 -07:00
Hitoshi Mitake 5a67dd788d *: support creating a user without password
This commit adds a feature for creating a user without password. The
purpose of the feature is reducing attack surface by configuring bad
passwords (CN based auth will be allowed for the user).

The feature can be used with `--no-password` of `etcdctl user add`
command.

Fix https://github.com/coreos/etcd/issues/9590
2019-05-30 21:59:30 +09:00
Jingyi Hu a7568d63a7 doc: clarify etcdctl default API version 2019-05-29 14:48:46 -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
WizardCXY a039f2efb8 clientv3, etcdctl: MemberPromote for learner 2019-05-15 13:48:52 -07:00
Jingyi Hu 355d0ab2a6 *: add learner field in endpoint status
Added learner field to endpoint status API.
2019-05-15 13:13:59 -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 1e38de5b9d etcdctl: add learner field in member list output 2019-05-14 13:10:22 -07:00
Jingyi Hu a67d934410 etcdctl: support MemberAdd for learner
Added support for "etcdctl member add --learner".
2019-05-14 13:10:22 -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
shivaramr 9150bf52d6 go modules: Fix module path version to include version number 2019-04-26 15:29:50 -07:00
Jake Utley a532b60c7e
etcdctl: Update README to clarify newline syntax in TXN
Add documentation to clarify that when writing TXN commands, multi-line values should be written using "\n" and not a literal newline (as in other commands).

Fixes #10169
2019-03-01 14:04:48 -08:00
Iskander Sharipov 48a2442fd7 etcdctl: fix strings.HasPrefix args order
Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
2019-02-02 02:39:27 +03:00
Gyuho Lee 3e0f0ba40e
Merge pull request #10401 from markmc/doc-drop-etcdctl-v3-flag
Eliminate some ETCDCTL_API=3 usage
2019-02-01 11:25:55 -08:00
Mark McLoughlin 36d7acf330 etcdctl: fix interactive mode panic
Don't panic if command is given in interactive mode, give a nice error
message instead.

Before:

 $ ./bin/etcdctl watch -i
 <hit return>
 panic: runtime error: index out of range

 goroutine 1 [running]:
 etcdctl/ctlv3/command.watchInteractiveFunc(...)
 	etcd/etcdctl/ctlv3/command/watch_command.go:104 ...

After:

 $ ./bin/etcdctl watch -i
 <hit return>
 Invalid command:  (watch and progress supported)
 foo
 Invalid command foo (only support watch)
2019-01-14 13:01:37 +00:00
Mark McLoughlin 071a0157e0 etcdctl: fix README to not suggest v2 is default
Note: v3 has been the default since 25bc65794.
2019-01-14 12:38:37 +00:00
Sam Batschelet a82703b69e *: error strings should not end with punctuation or a newline (ST1005)
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2019-01-08 21:04:20 -05:00
Jingyi Hu 5b6b03d081 etcdctl: add timeout to snapshot save command
snapshot save command by default has no timeout, but respects user
specified command timeout.
2018-12-04 20:36:48 -08:00
Shin'ya Ueoka aa4313a55a *: fix github links 2018-11-10 11:14:18 +09:00
Sam Batschelet fa35126ef8
*: add client support for discovery-srv-name
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2018-11-09 10:13:04 -05:00
Gyuho Lee 1a8c520979 ctlv3: fix gofmt
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-09-28 09:53:24 -07:00
Danny Sauer 36d227c9e5
etcdctl: Prettier error handling in member add
Maintain existing error message for not-enough-args
Add "too many args" if too many args
Add more helpful error message if v2 syntax was used

New output:
```
sauer@host:~/dev/etcd$ ./bin/etcdctl --endpoints http://localhost:5001 member add
Error: member name not provided.
sauer@host:~/dev/etcd$ ./bin/etcdctl --endpoints http://localhost:5001 member add node2 node2
Error: too many arguments
sauer@host:~/dev/etcd$ ./bin/etcdctl --endpoints http://localhost:5001 member add node2 http://localhost:6002
Error: too many arguments, did you mean "--peer-urls http://localhost:6002"
sauer@host:~/dev/etcd$ ./bin/etcdctl --endpoints http://localhost:5001 member add http://localhost:6002 node2
Error: too many arguments, did you mean "--peer-urls http://localhost:6002"
```
2018-09-25 16:50:57 -05:00