diff --git a/fuel_ccp_entrypoint/start_script.py b/fuel_ccp_entrypoint/start_script.py index 206f127..9fafc6f 100644 --- a/fuel_ccp_entrypoint/start_script.py +++ b/fuel_ccp_entrypoint/start_script.py @@ -518,6 +518,8 @@ def get_variables(role_name): LOG.info("Get CCP environment variables") variables['node_name'] = os.environ['CCP_NODE_NAME'] variables['pod_name'] = os.environ['CCP_POD_NAME'] + variables['memory_limit'] = os.environ['MEMORY_LIMIT'] + variables['cpu_limit'] = os.environ['CPU_LIMIT'] LOG.debug("Creating network topology ") variables["network_topology"] = create_network_topology(meta_info, variables) diff --git a/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py b/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py index 24176cf..3ee3fcb 100644 --- a/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py +++ b/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py @@ -75,11 +75,15 @@ class TestGetVariables(base.TestCase): super(TestGetVariables, self).setUp() os.environ['CCP_NODE_NAME'] = 'node1' os.environ['CCP_POD_NAME'] = 'pod1' + os.environ['MEMORY_LIMIT'] = '7859277824' + os.environ['CPU_LIMIT'] = '4' def tearDown(self): super(TestGetVariables, self).tearDown() del os.environ['CCP_NODE_NAME'] del os.environ['CCP_POD_NAME'] + del os.environ['MEMORY_LIMIT'] + del os.environ['CPU_LIMIT'] @mock.patch('six.moves.builtins.open', mock.mock_open()) @mock.patch('json.load') @@ -93,7 +97,9 @@ class TestGetVariables(base.TestCase): 'role_name': 'role', 'network_topology': 'network_topology', 'node_name': 'node1', - 'pod_name': 'pod1' + 'pod_name': 'pod1', + 'cpu_limit': '4', + 'memory_limit': '7859277824' } self.assertEqual(r_value, e_value) @@ -144,6 +150,8 @@ class TestGetVariables(base.TestCase): 'role_name': 'fake_role', 'network_topology': 'network_topology', 'node_name': 'node1', + 'cpu_limit': '4', + 'memory_limit': '7859277824', 'pod_name': 'pod1', 'a': { 'b': {