From b398947cf9ee7e9bf6be667ca23eefc99ab5597f Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 14 Jan 2019 12:38:24 +0000 Subject: [PATCH 1/7] doc: don't use ETCDCTL_API=3 in dl_build In the spirit of keeping newb instructions simple, do not specify ETCDCTL_API=3 since it is redundant. Note: v3 has been the default since 25bc65794. --- Documentation/dl_build.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/dl_build.md b/Documentation/dl_build.md index 57e7374e6d3..00b656fe501 100644 --- a/Documentation/dl_build.md +++ b/Documentation/dl_build.md @@ -52,11 +52,11 @@ $ $GOPATH/bin/etcd Run the following: ```sh -$ ETCDCTL_API=3 ./bin/etcdctl put foo bar +$ ./bin/etcdctl put foo bar OK ``` -(or `ETCDCTL_API=3 $GOPATH/bin/etcdctl put foo bar` if etcdctl was installed with `go get`) +(or `$GOPATH/bin/etcdctl put foo bar` if etcdctl was installed with `go get`) If OK is printed, then etcd is working! From 39ef3901efa19640595cbc3ae8af52048511d573 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 14 Jan 2019 12:36:01 +0000 Subject: [PATCH 2/7] README: stop using ETCDCTL_API=3 Note: v3 has been the default since 25bc65794. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 91716485936..d1cd2fc62e2 100644 --- a/README.md +++ b/README.md @@ -105,8 +105,8 @@ This will bring up etcd listening on port 2379 for client communication and on p Next, let's set a single key, and then retrieve it: ``` -ETCDCTL_API=3 etcdctl put mykey "this is awesome" -ETCDCTL_API=3 etcdctl get mykey +etcdctl put mykey "this is awesome" +etcdctl get mykey ``` etcd is now running and serving client requests. For more, please check out: From 071a0157e028236296297d45dbe9eac774ef4b27 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 14 Jan 2019 12:29:08 +0000 Subject: [PATCH 3/7] etcdctl: fix README to not suggest v2 is default Note: v3 has been the default since 25bc65794. --- etcdctl/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etcdctl/README.md b/etcdctl/README.md index e3b14e7c4f3..0ac943aa322 100644 --- a/etcdctl/README.md +++ b/etcdctl/README.md @@ -2,7 +2,8 @@ etcdctl ======== `etcdctl` is a command line client for [etcd][etcd]. -Make sure to set environment variable `ETCDCTL_API=3`. For etcdctl v2, please check [READMEv2][READMEv2]. + +The v3 API is used by default. For the v2 API, make sure to set environment variable `ETCDCTL_API=2`. See also [READMEv2][READMEv2]. Global flags (e.g., `dial-timeout`, `--cacert`, `--cert`, `--key`) can be set with environment variables: From 034312eac5532eb33648514b7cb42223c4bdb390 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 14 Jan 2019 12:17:14 +0000 Subject: [PATCH 4/7] doc: fix note that says ETCDCTL_API=2 is the default Note: v3 has been the default since 25bc65794. --- Documentation/dev-guide/interacting_v3.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/dev-guide/interacting_v3.md b/Documentation/dev-guide/interacting_v3.md index 38c3c7b1ba2..c97043ed8ec 100644 --- a/Documentation/dev-guide/interacting_v3.md +++ b/Documentation/dev-guide/interacting_v3.md @@ -2,7 +2,9 @@ Users mostly interact with etcd by putting or getting the value of a key. This section describes how to do that by using etcdctl, a command line tool for interacting with etcd server. The concepts described here should apply to the gRPC APIs or client library APIs. -By default, etcdctl talks to the etcd server with the v2 API for backward compatibility. For etcdctl to speak to etcd using the v3 API, the API version must be set to version 3 via the `ETCDCTL_API` environment variable. However note that any key that was created using the v2 API will not be able to be queried via the v3 API. A v3 API ```etcdctl get``` of a v2 key will exit with 0 and no key data, this is the expected behaviour. +The API version used by etcdctl to speak to etcd may be set to version `2` or `3` via the `ETCDCTL_API` environment variable. By default, etcdctl on master (3.4) uses the v3 API and earlier versions (3.3 and earlier) default to the v2 API. + +Note that any key that was created using the v2 API will not be able to be queried via the v2 API. A v3 API ```etcdctl get``` of a v2 key will exit with 0 and no key data, this is the expected behaviour. ```bash From 0427f46f17cb9644bf5c0de8370c671d3faed0f5 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 14 Jan 2019 12:20:04 +0000 Subject: [PATCH 5/7] doc: don't set ETCDCTL_API=3 in local_cluster guide These docs are incorrectly saying that v2 is the default. Note: v3 has been the default since 25bc65794. --- Documentation/dev-guide/local_cluster.md | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/Documentation/dev-guide/local_cluster.md b/Documentation/dev-guide/local_cluster.md index 92ed1bc2203..26a97beec57 100644 --- a/Documentation/dev-guide/local_cluster.md +++ b/Documentation/dev-guide/local_cluster.md @@ -21,14 +21,7 @@ The running etcd member listens on `localhost:2379` for client requests. Use `etcdctl` to interact with the running cluster: -1. Configure the environment to have `ETCDCTL_API=3` so `etcdctl` uses the etcd API version 3 instead of defaulting to version 2. - - ``` - # use API version 3 - $ export ETCDCTL_API=3 - ``` - -2. Store an example key-value pair in the cluster: +1. Store an example key-value pair in the cluster: ``` $ ./etcdctl put foo bar @@ -37,7 +30,7 @@ Use `etcdctl` to interact with the running cluster: If OK is printed, storing key-value pair is successful. -3. Retrieve the value of `foo`: +2. Retrieve the value of `foo`: ``` $ ./etcdctl get foo @@ -70,14 +63,7 @@ A `Procfile` at the base of the etcd git repository is provided to easily config Use `etcdctl` to interact with the running cluster: -1. Configure the environment to have `ETCDCTL_API=3` so `etcdctl` uses the etcd API version 3 instead of defaulting to version 2. - - ``` - # use API version 3 - $ export ETCDCTL_API=3 - ``` - -2. Print the list of members: +1. Print the list of members: ``` $ etcdctl --write-out=table --endpoints=localhost:2379 member list @@ -94,7 +80,7 @@ Use `etcdctl` to interact with the running cluster: +------------------+---------+--------+------------------------+------------------------+ ``` -3. Store an example key-value pair in the cluster: +2. Store an example key-value pair in the cluster: ``` $ etcdctl put foo bar From 4d45a9ca432f687cfffa4b26961110276f6186b8 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 14 Jan 2019 12:32:57 +0000 Subject: [PATCH 6/7] build: stop using ETCDCTL_API=3 Note: v3 has been the default since 25bc65794. --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2fcea46dc21..21ba4860038 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ build: GO_BUILD_FLAGS="-v" ./build ./bin/etcd --version - ETCDCTL_API=3 ./bin/etcdctl version + ./bin/etcdctl version clean: rm -f ./codecov @@ -197,7 +197,7 @@ build-docker-release-master: docker run \ --rm \ gcr.io/etcd-development/etcd:$(ETCD_VERSION) \ - /bin/sh -c "/usr/local/bin/etcd --version && ETCDCTL_API=3 /usr/local/bin/etcdctl version" + /bin/sh -c "/usr/local/bin/etcd --version && /usr/local/bin/etcdctl version" push-docker-release-master: $(info ETCD_VERSION: $(ETCD_VERSION)) @@ -500,7 +500,7 @@ build-docker-functional: gcr.io/etcd-development/etcd-functional:go$(GO_VERSION) \ /bin/bash -c "./bin/etcd --version && \ ./bin/etcd-failpoints --version && \ - ETCDCTL_API=3 ./bin/etcdctl version && \ + ./bin/etcdctl version && \ ./bin/etcd-agent -help || true && \ ./bin/etcd-proxy -help || true && \ ./bin/etcd-runner --help || true && \ From e53324db3b935193ead6e64e237cae29cb5910cc Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 14 Jan 2019 12:34:32 +0000 Subject: [PATCH 7/7] scripts/release: stop using ETCDCTL_API=3 Note: v3 has been the default since 25bc65794. --- scripts/release | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/release b/scripts/release index 5f553cfcdc3..789e600229d 100755 --- a/scripts/release +++ b/scripts/release @@ -142,7 +142,7 @@ main() { # Sanity checks. ./release/etcd-${RELEASE_VERSION}-linux-amd64/etcd --version | grep -q "etcd Version: ${VERSION}" - ETCDCTL_API=3 ./release/etcd-${RELEASE_VERSION}-linux-amd64/etcdctl version | grep -q "etcdctl version: ${VERSION}" + ./release/etcd-${RELEASE_VERSION}-linux-amd64/etcdctl version | grep -q "etcdctl version: ${VERSION}" # Upload artifacts. if [ "${NO_UPLOAD}" == 1 ]; then @@ -188,9 +188,9 @@ main() { # TODO: test # docker run --rm --name etcd-gcr-${RELEASE_VERSION} gcr.io/etcd-development/etcd:${RELEASE_VERSION}; # docker exec etcd-gcr-${RELEASE_VERSION} /bin/sh -c "/usr/local/bin/etcd --version" - # docker exec etcd-gcr-${RELEASE_VERSION} /bin/sh -c "ETCDCTL_API=3 /usr/local/bin/etcdctl version" - # docker exec etcd-gcr-${RELEASE_VERSION} /bin/sh -c "ETCDCTL_API=3 /usr/local/bin/etcdctl put foo bar" - # docker exec etcd-gcr-${RELEASE_VERSION} /bin/sh -c "ETCDCTL_API=3 /usr/local/bin/etcdctl get foo" + # docker exec etcd-gcr-${RELEASE_VERSION} /bin/sh -c "/usr/local/bin/etcdctl version" + # docker exec etcd-gcr-${RELEASE_VERSION} /bin/sh -c "/usr/local/bin/etcdctl put foo bar" + # docker exec etcd-gcr-${RELEASE_VERSION} /bin/sh -c "/usr/local/bin/etcdctl get foo" # Bump version to next development version. git checkout -q "${BRANCH}" # Since we might be on a checkout of the remote version tag.