diff --git a/octaviaclient/osc/v2/constants.py b/octaviaclient/osc/v2/constants.py index 0095048..6619a99 100644 --- a/octaviaclient/osc/v2/constants.py +++ b/octaviaclient/osc/v2/constants.py @@ -100,7 +100,8 @@ POOL_ROWS = ( 'protocol', 'provisioning_status', 'session_persistence', - 'updated_at') + 'updated_at', + 'tls_container_ref') POOL_COLUMNS = ( 'id', diff --git a/octaviaclient/osc/v2/pool.py b/octaviaclient/osc/v2/pool.py index f559984..a075eec 100644 --- a/octaviaclient/osc/v2/pool.py +++ b/octaviaclient/osc/v2/pool.py @@ -87,6 +87,13 @@ class CreatePool(command.ShowOne): default=None, help="Disable pool." ) + parser.add_argument( + '--tls-container-ref', + metavar='', + help="The reference to the key manager service secrets container " + "containing the certificate and key for ``tls_enabled``" + "pools to re-encrpt the traffic to backend member servers." + ) return parser @@ -232,6 +239,14 @@ class SetPool(command.Command): default=None, help="Disable pool." ) + parser.add_argument( + '--tls-container-ref', + metavar='', + help="The URI to the key manager service secrets container " + "containing the certificate and key for TERMINATED_TLS " + "pools to re-encrpt the traffic from TERMINATED_TLS " + "listener to backend servers." + ) return parser diff --git a/octaviaclient/osc/v2/utils.py b/octaviaclient/osc/v2/utils.py index ed775eb..bd5cbbf 100644 --- a/octaviaclient/osc/v2/utils.py +++ b/octaviaclient/osc/v2/utils.py @@ -252,7 +252,9 @@ def get_pool_attrs(client_manager, parsed_args): ), 'session_persistence': ('session_persistence', _format_kv), 'enable': ('admin_state_up', lambda x: True), - 'disable': ('admin_state_up', lambda x: False) + 'disable': ('admin_state_up', lambda x: False), + 'tls_container_ref': ('tls_container_ref', + _format_str_if_need_treat_unset), } _attrs = vars(parsed_args) diff --git a/octaviaclient/tests/unit/osc/v2/constants.py b/octaviaclient/tests/unit/osc/v2/constants.py index 06c750f..1d3192e 100644 --- a/octaviaclient/tests/unit/osc/v2/constants.py +++ b/octaviaclient/tests/unit/osc/v2/constants.py @@ -147,6 +147,7 @@ POOL_ATTRS = { "project_id": uuidutils.generate_uuid(dashed=True), "protocol": "HTTP", "provisioning_status": "ACTIVE", + "tls_container_ref": uuidutils.generate_uuid() } QUOTA_ATTRS = { diff --git a/octaviaclient/tests/unit/osc/v2/test_pool.py b/octaviaclient/tests/unit/osc/v2/test_pool.py index 1d8b351..96f7897 100644 --- a/octaviaclient/tests/unit/osc/v2/test_pool.py +++ b/octaviaclient/tests/unit/osc/v2/test_pool.py @@ -104,13 +104,15 @@ class TestPoolCreate(TestPool): arglist = ['--loadbalancer', 'mock_lb_id', '--name', self._po.name, '--protocol', 'HTTP', - '--lb-algorithm', 'ROUND_ROBIN'] + '--lb-algorithm', 'ROUND_ROBIN', + '--tls-container-ref', self._po.tls_container_ref] verifylist = [ ('loadbalancer', 'mock_lb_id'), ('name', self._po.name), ('protocol', 'HTTP'), - ('lb_algorithm', 'ROUND_ROBIN') + ('lb_algorithm', 'ROUND_ROBIN'), + ('tls_container_ref', self._po.tls_container_ref) ] parsed_args = self.check_parser(self.cmd, arglist, verifylist) @@ -147,7 +149,9 @@ class TestPoolSet(TestPool): self.cmd = pool.SetPool(self.app, None) def test_pool_set(self): - arglist = [self._po.id, '--name', 'new_name'] + new_tls_id = 'test-tls-container-id' + arglist = [self._po.id, '--name', 'new_name', '--tls-container-ref', + new_tls_id] verifylist = [ ('pool', self._po.id), ('name', 'new_name') @@ -156,4 +160,5 @@ class TestPoolSet(TestPool): parsed_args = self.check_parser(self.cmd, arglist, verifylist) self.cmd.take_action(parsed_args) self.api_mock.pool_set.assert_called_with( - self._po.id, json={'pool': {'name': 'new_name'}}) + self._po.id, json={'pool': {'name': 'new_name', + 'tls_container_ref': new_tls_id}})