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:
7496e5e1c3

Depends-On: https://review.opendev.org/c/openstack/devstack/+/891353
Change-Id: Ibb5e587f6b1348794b1bf4d6405bc4a32a653c2c
This commit is contained in:
Jan Gutter 2023-08-14 21:20:44 +01:00
parent 0feead5deb
commit 738931d026
6 changed files with 16 additions and 26 deletions

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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/"

View File

@ -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()

View File

@ -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')