Commit Graph

545 Commits (5c726cfe255a2ea50c2a1c8e5d0f893e60eb451a)

Author SHA1 Message Date
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
Jingyi Hu 78d02f4229 etcdctl: improve doc on etcdctl lock command 2018-09-24 14:25:02 -07:00
Gyuho Lee 8db439d693 *: use "go.etcd.io/bbolt"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-29 12:31:28 -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
Sahdev P. Zala b4a670b571 etcdctl: fix small inconsistency with RPC
Several RPC references in README with memberlist only hyperlinked,
and since it's linked with line numbers it's not pointing to a
desired ref now. Remove the link to make it consistent and correct.
2018-08-23 10:48:32 -04:00
Sahdev P. Zala 7f001c1f00 etcdctl: fix get command error when no arg provided
The current error is incorrect. Providing a similar one to the del
command.
2018-08-19 19:54:18 -04:00