Add HTTP/2 over TLS support to amphora provider

HTTP/2 requires HAProxy 2.0 or newer in amphora images. The operating
system versions in test as of today (Ubuntu Bionic and CentOS 8) do not
provide HAProxy 2.x in their official repositories. For this reason, the
default listener ALPN protocol list remains unchanged, defaulting to
ALPN protocol IDs "http/1.1" and "http/1.0".

Change-Id: Id29d0d2cd5ab1ae3c7d26194a235af25c2271d62
This commit is contained in:
Carlos Goncalves 2020-08-05 14:49:24 +02:00
parent a5f0524fd0
commit de2fe22f9d
4 changed files with 12 additions and 9 deletions

View File

@ -859,5 +859,6 @@ SUPPORTED_ALPN_PROTOCOLS = [lib_consts.ALPN_PROTOCOL_HTTP_2,
lib_consts.ALPN_PROTOCOL_HTTP_1_1,
lib_consts.ALPN_PROTOCOL_HTTP_1_0]
AMPHORA_SUPPORTED_ALPN_PROTOCOLS = [lib_consts.ALPN_PROTOCOL_HTTP_1_1,
AMPHORA_SUPPORTED_ALPN_PROTOCOLS = [lib_consts.ALPN_PROTOCOL_HTTP_2,
lib_consts.ALPN_PROTOCOL_HTTP_1_1,
lib_consts.ALPN_PROTOCOL_HTTP_1_0]

View File

@ -132,8 +132,7 @@ class TestAmphoraDriver(base.TestRpc):
def test_listener_create_unsupported_alpn(self, mock_cast):
provider_listener = driver_dm.Listener(
listener_id=self.sample_data.listener1_id)
# NOTE(cgoncalves): test will fail once HTTP/2 is supported
provider_listener.alpn_protocols = ['http/1.1', 'h2']
provider_listener.alpn_protocols = ['http/1.1', 'eureka']
self.assertRaises(
exceptions.UnsupportedOptionError,
self.amp_driver.listener_create,
@ -178,10 +177,9 @@ class TestAmphoraDriver(base.TestRpc):
def test_listener_update_unsupported_alpn(self, mock_cast):
old_provider_listener = driver_dm.Listener(
listener_id=self.sample_data.listener1_id)
# NOTE(cgoncalves): test will fail once HTTP/2 is supported
provider_listener = driver_dm.Listener(
listener_id=self.sample_data.listener1_id,
alpn_protocols=['http/1.1', 'h2'])
alpn_protocols=['http/1.1', 'eureka'])
self.assertRaises(
exceptions.UnsupportedOptionError,
self.amp_driver.listener_update,

View File

@ -132,8 +132,7 @@ class TestAmphoraDriver(base.TestRpc):
def test_listener_create_unsupported_alpn(self, mock_cast):
provider_listener = driver_dm.Listener(
listener_id=self.sample_data.listener1_id)
# NOTE(cgoncalves): test will fail once HTTP/2 is supported
provider_listener.alpn_protocols = ['http/1.1', 'h2']
provider_listener.alpn_protocols = ['http/1.1', 'eureka']
self.assertRaises(
exceptions.UnsupportedOptionError,
self.amp_driver.listener_create,
@ -180,10 +179,9 @@ class TestAmphoraDriver(base.TestRpc):
def test_listener_update_unsupported_alpn(self, mock_cast):
old_provider_listener = driver_dm.Listener(
listener_id=self.sample_data.listener1_id)
# NOTE(cgoncalves): test will fail once HTTP/2 is supported
provider_listener = driver_dm.Listener(
listener_id=self.sample_data.listener1_id,
alpn_protocols=['http/1.1', 'h2'])
alpn_protocols=['http/1.1', 'eureka'])
self.assertRaises(
exceptions.UnsupportedOptionError,
self.amp_driver.listener_update,

View File

@ -0,0 +1,6 @@
---
features:
- |
Added HTTP/2 over TLS support via ALPN protocol negotiation to the
amphora provider driver. Feature available in amphora images with HAProxy
2.0 or newer.