From 738931d026aedb846ed3970cf642a6c570a2bceb Mon Sep 17 00:00:00 2001 From: Jan Gutter Date: Mon, 14 Aug 2023 21:20:44 +0100 Subject: [PATCH] Update the default etcd3gw endpoint to v3 * Recent versions of etcd no longer support the /v3alpha/ endpoint * It's probably better to skip directly to the /v3/ endpoint as a default. * Note that this probably means a new minor version of tooz, while the behaviour can be worked around in config, this is enough to break existing systems on upgrade. * Updated the test to test backwards compatibility. * Updated the tests to use etcd 3.3.27, unfortunately we need a newer version of pifpaf that supports 3.4 before the default api can be used. * The etcd backend tests have been removed: the deprecated backend uses the v2 api which is no longer provided - a future commit should remove the deprecated backend. The etcd3gw backend is the replacement. This fix is required in pifpaf, but it's not in any release: https://github.com/jd/pifpaf/commit/7496e5e1c3d890eadcc491f2bcc1160d9395d8b0 Depends-On: https://review.opendev.org/c/openstack/devstack/+/891353 Change-Id: Ibb5e587f6b1348794b1bf4d6405bc4a32a653c2c --- .zuul.yaml | 20 ------------------- .../notes/etcd-3.4-eee8300c942a1263.yaml | 7 +++++++ setup-etcd-env.sh | 2 +- tooz/drivers/etcd3gw.py | 4 ++-- tooz/tests/__init__.py | 5 ++++- tooz/tests/drivers/test_etcd3gw.py | 4 ++-- 6 files changed, 16 insertions(+), 26 deletions(-) create mode 100644 releasenotes/notes/etcd-3.4-eee8300c942a1263.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 9122fbac..6d0a53f6 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -8,8 +8,6 @@ - release-notes-jobs-python3 check: jobs: - - tooz-tox-py38-etcd - - tooz-tox-py310-etcd - tooz-tox-py38-etcd3gw - tooz-tox-py310-etcd3gw - tooz-tox-py38-zookeeper @@ -28,8 +26,6 @@ - tooz-tox-py310-consul gate: jobs: - - tooz-tox-py38-etcd - - tooz-tox-py310-etcd - tooz-tox-py38-etcd3gw - tooz-tox-py310-etcd3gw - tooz-tox-py38-zookeeper @@ -55,14 +51,6 @@ vars: tox_envlist: py38-consul -- job: - name: tooz-tox-py38-etcd - parent: openstack-tox-py38 - description: | - Run tests using ``py38-etcd`` environment. - vars: - tox_envlist: py38-etcd - - job: name: tooz-tox-py38-etcd3gw parent: openstack-tox-py38 @@ -131,14 +119,6 @@ vars: tox_envlist: py310-consul -- job: - name: tooz-tox-py310-etcd - parent: openstack-tox-py310 - description: | - Run tests using ``py310-etcd`` environment. - vars: - tox_envlist: py310-etcd - - job: name: tooz-tox-py310-etcd3gw parent: openstack-tox-py310 diff --git a/releasenotes/notes/etcd-3.4-eee8300c942a1263.yaml b/releasenotes/notes/etcd-3.4-eee8300c942a1263.yaml new file mode 100644 index 00000000..8c9044ec --- /dev/null +++ b/releasenotes/notes/etcd-3.4-eee8300c942a1263.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - | + This version of tooz defaults to the `v3` endpoint for the `etcd3gw` + backend. The previous behavior can be restored by appending + `?api_version=v3alpha` to the coordination URL. The `v3alpha` and + `v3beta` endpoints have been deprecated by upstream etcd. diff --git a/setup-etcd-env.sh b/setup-etcd-env.sh index cfdbaac5..919aee12 100755 --- a/setup-etcd-env.sh +++ b/setup-etcd-env.sh @@ -1,7 +1,7 @@ #!/bin/bash set -eux if [ -z "$(which etcd)" ]; then - ETCD_VERSION=3.1.3 + ETCD_VERSION=3.3.27 case `uname -s` in Darwin) OS=darwin diff --git a/tooz/drivers/etcd3gw.py b/tooz/drivers/etcd3gw.py index 08f348d0..5d058dee 100644 --- a/tooz/drivers/etcd3gw.py +++ b/tooz/drivers/etcd3gw.py @@ -181,7 +181,7 @@ class Etcd3Driver(coordination.CoordinationDriverCachedRunWatchers, ================== ======= Name Default ================== ======= - api_version v3alpha + api_version v3 ca_cert None cert_key None cert_cert None @@ -201,7 +201,7 @@ class Etcd3Driver(coordination.CoordinationDriverCachedRunWatchers, DEFAULT_PORT = 2379 #: Default api version if none provided - DEFAULT_API_VERSION = "v3alpha" + DEFAULT_API_VERSION = "v3" GROUP_PREFIX = b"tooz/groups/" diff --git a/tooz/tests/__init__.py b/tooz/tests/__init__.py index b7acfa14..f9050097 100644 --- a/tooz/tests/__init__.py +++ b/tooz/tests/__init__.py @@ -58,7 +58,10 @@ class TestWithCoordinator(testcase.TestCase, metaclass=SkipNotImplementedMeta): if os.getenv("TOOZ_TEST_ETCD3"): self.url = self.url.replace("etcd://", "etcd3://") if os.getenv("TOOZ_TEST_ETCD3GW"): - self.url = self.url.replace("etcd://", "etcd3+http://") + # TODO(jan.gutter): When pifpaf supports etcd 3.4 we should use the + # defaults + self.url = self.url.replace("etcd://", "etcd3+http://") + \ + "?api_version=v3beta" self.useFixture(fixtures.NestedTempfile()) self.group_id = get_random_uuid() self.member_id = get_random_uuid() diff --git a/tooz/tests/drivers/test_etcd3gw.py b/tooz/tests/drivers/test_etcd3gw.py index 3b8a09cf..ea417895 100644 --- a/tooz/tests/drivers/test_etcd3gw.py +++ b/tooz/tests/drivers/test_etcd3gw.py @@ -39,14 +39,14 @@ class TestEtcd3Gw(testcase.TestCase): 'timeout': etcd3gw_driver.Etcd3Driver.DEFAULT_TIMEOUT}, {'coord_url': ('etcd3+https://my_host:666?ca_cert=/my/ca_cert&' 'cert_key=/my/cert_key&cert_cert=/my/cert_cert&' - 'timeout=42&api_version=v3'), + 'timeout=42&api_version=v3alpha'), 'protocol': 'https', 'host': 'my_host', 'port': 666, 'ca_cert': '/my/ca_cert', 'cert_key': '/my/cert_key', 'cert_cert': '/my/cert_cert', - 'api_path': '/v3/', + 'api_path': '/v3alpha/', 'timeout': 42}) @ddt.unpack @mock.patch('etcd3gw.client')