blob: b3a3013e1f75d3d84933e37152451573781cd69b [file] [log] [blame]
Dennis Dmitriev6f59add2016-10-18 13:45:27 +03001# Copyright 2016 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14import copy
15import os
16import pkg_resources
17
18from oslo_config import cfg
19from oslo_config import generator
20
21from tcp_tests.helpers import ext
22from tcp_tests.helpers import oslo_cfg_types as ct
23from tcp_tests import settings
24
Dennis Dmitriev9b02c8b2017-11-13 15:31:35 +020025print("\n" + "-" * 10 + " Initialize oslo.config variables with defaults"
26 " from environment" + "-" * 10)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +030027
28_default_conf = pkg_resources.resource_filename(
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030029 __name__, 'templates/{0}/underlay.yaml'.format(settings.LAB_CONFIG_NAME))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020030
31_default_salt_steps = pkg_resources.resource_filename(
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030032 __name__, 'templates/{0}/salt.yaml'.format(settings.LAB_CONFIG_NAME))
Dennis Dmitriev9dada8a2017-08-30 17:38:55 +030033_default_environment_template_dir = pkg_resources.resource_filename(
34 __name__, 'environment/')
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +030035_default_templates_dir = pkg_resources.resource_filename(
36 __name__, 'templates/')
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030037_default_core_steps = pkg_resources.resource_filename(
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020038 __name__,
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030039 'templates/{0}/core.yaml'.format(
Dennis Dmitriev2a13a132016-11-04 00:56:23 +020040 settings.LAB_CONFIG_NAME))
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +030041_default_oss_steps = pkg_resources.resource_filename(
42 __name__,
43 'templates/{0}/oss.yaml'.format(
44 settings.LAB_CONFIG_NAME))
sgudzb67ce732018-02-13 17:58:31 +020045_default_drivetrain_steps = pkg_resources.resource_filename(
46 __name__,
47 'templates/{0}/drivetrain.yaml'.format(
48 settings.LAB_CONFIG_NAME))
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +030049_default_decapod_steps = pkg_resources.resource_filename(
50 __name__,
51 'templates/{0}/decapod.yaml'.format(
52 settings.LAB_CONFIG_NAME))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +020053_default_openstack_steps = pkg_resources.resource_filename(
Dennis Dmitrievab83ea42017-05-12 16:52:45 +030054 __name__, 'templates/{0}/openstack.yaml'.format(
Dennis Dmitriev2a13a132016-11-04 00:56:23 +020055 settings.LAB_CONFIG_NAME))
Tatyana Leontovich8dbc7882018-08-29 13:11:16 +030056_default_openstack_resources_steps = pkg_resources.resource_filename(
57 __name__, 'templates/{0}/post_openstack.yaml'.format(
58 settings.LAB_CONFIG_NAME))
Dina Belovae6fdffb2017-09-19 13:58:34 -070059_default_opencontrail_prepare_tests_steps_path = \
60 pkg_resources.resource_filename(
61 __name__, 'templates/{0}/opencontrail.yaml'.format(
62 settings.LAB_CONFIG_NAME))
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030063_default_sl_prepare_tests_steps_path = pkg_resources.resource_filename(
64 __name__, 'templates/{0}/sl.yaml'.format(
65 settings.LAB_CONFIG_NAME))
Tatyana Leontovich460f7df2017-11-13 15:45:06 +020066_default_ceph_prepare_tests_steps_path = pkg_resources.resource_filename(
67 __name__, 'templates/{0}/ceph.yaml'.format(
68 settings.LAB_CONFIG_NAME))
Artem Panchenko0594cd72017-06-12 13:25:26 +030069_default_k8s_steps = pkg_resources.resource_filename(
70 __name__, 'templates/{0}/k8s.yaml'.format(
71 settings.LAB_CONFIG_NAME))
Vladimir Jigulin62bcf462018-05-28 18:17:01 +040072_default_k8s_update_steps = pkg_resources.resource_filename(
73 __name__, 'templates/{0}/k8s-update.yaml'.format(
74 settings.LAB_CONFIG_NAME))
Dmitry Tyzhnenkob8641832017-11-07 17:02:47 +020075_default_net_mgm = os.environ.get("NET_MGMT", "admin-pool01")
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +020076_default_configure_steps = pkg_resources.resource_filename(
77 __name__, 'templates/{0}/cfg01_configure.yaml'.format(
78 settings.LAB_CONFIG_NAME))
79# _default_cluster_maas_config = pkg_resources.resource_filename(
80# __name__, 'templates/{0}/cluster_infra_maas.yml'.format(
81# settings.LAB_CONFIG_NAME))
82_default_cluster_maas_config = 'cluster_infra_maas.yml'
Dennis Dmitriev6f59add2016-10-18 13:45:27 +030083
84hardware_opts = [
85 ct.Cfg('manager', ct.String(),
86 help="Hardware manager name", default="devops"),
87 ct.Cfg('conf_path', ct.String(),
88 help="Hardware config file", default=_default_conf),
89 ct.Cfg('current_snapshot', ct.String(),
90 help="Latest environment status name",
91 default=ext.SNAPSHOT.hardware),
92]
93
94
95underlay_opts = [
96 ct.Cfg('ssh', ct.JSONList(),
97 help="""SSH Settings for Underlay: [{
98 'node_name': node1,
Dennis Dmitriev23e5d192016-10-31 11:27:10 +020099 'roles': ['salt-master', 'salt-minion', ],
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300100 'host': hostname,
101 'login': login,
102 'password': password,
103 'address_pool': (optional),
104 'port': (optional),
105 'keys': [(optional)],
106 }, ...]""", default=[]),
107 ct.Cfg('roles', ct.JSONList(),
108 help="Node roles managed by underlay in the environment",
Dennis Dmitriev53d3b772016-10-18 14:31:58 +0300109 default=[ext.UNDERLAY_NODE_ROLES.salt_master,
vrovachev99228d32017-06-08 19:46:10 +0400110 ext.UNDERLAY_NODE_ROLES.salt_minion,
Victor Ryzhenkin66d39372017-09-28 19:25:48 +0400111 ext.UNDERLAY_NODE_ROLES.k8s_controller]),
Dennis Dmitriev7b9538f2017-05-15 17:01:34 +0300112 ct.Cfg('bootstrap_timeout', ct.Integer(),
113 help="Timeout of waiting SSH for nodes with specified roles",
Dennis Dmitriev4558ee92018-01-31 08:14:08 -0400114 default=600),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300115 ct.Cfg('nameservers', ct.JSONList(),
116 help="IP addresses of DNS servers",
117 default=[]),
118 ct.Cfg('upstream_dns_servers', ct.JSONList(),
119 help="IP addresses of upstream DNS servers (dnsmasq)",
120 default=[]),
Dennis Dmitriev99b26fe2017-04-26 12:34:44 +0300121 ct.Cfg('address_pools', ct.JSONDict(),
122 help="""Address pools (dynamically) allocated for the environment.
123 May be used to determine CIDR for a specific network from
124 tests or during the deployment process.
125 {'pool_name1': '<cidr>', 'pool_name2': '<cidr>', ...}""",
126 default={}),
Dennis Dmitrievb6bcc5c2018-09-26 11:07:53 +0000127 ct.Cfg('dhcp_ranges', ct.JSONDict(),
128 help="""DHCP ranges allocated for the address pools.
129 This is extended object comparing to 'address_pools'.
130 May be used to determine DHCP range start/end/gateway for a
131 specific network from tests or during the deployment
132 process.
133 {'pool_name1': {'cidr': 'n.n.n.n/m',
134 'start': 'x.x.x.x',
135 'end': 'y.y.y.y',
136 'gateway': 'z.z.z.z'},
137 'pool_name2': {'cidr': 'n.n.n.n/m',
138 'start': x.x.x.x,
139 'end': 'y.y.y.y',
140 'gateway': 'z.z.z.z'},
141 ...}""",
142 default={}),
Artem Panchenkodb0a97f2017-06-27 19:09:13 +0300143 ct.Cfg('ssh_keys', ct.JSONList(), default=[],
144 help="SSH key pair(s) for root. If the option is left empty, "
145 "then a key pair will be generated automatically"),
146 ct.Cfg('ssh_key_file', ct.String(), default=os.path.abspath('./id_rsa'),
147 help='Path (local) to file with private key authorized on nodes'),
Dmitry Tyzhnenkob8641832017-11-07 17:02:47 +0200148 ct.Cfg('net_mgmt', ct.String(), default=_default_net_mgm)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300149]
150
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200151
152salt_deploy_opts = [
153 ct.Cfg('salt_steps_path', ct.String(),
154 help="Path to YAML with steps to deploy salt",
155 default=_default_salt_steps),
Dennis Dmitriev9dada8a2017-08-30 17:38:55 +0300156 ct.Cfg('environment_template_dir', ct.String(),
157 help="Path to directory with Environment template and inventory",
158 default=_default_environment_template_dir),
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +0300159 ct.Cfg('templates_dir', ct.String(),
160 help="Path to directory with templates",
161 default=_default_templates_dir),
Dennis Dmitriev5bcbdc52018-03-23 18:05:10 +0200162 ct.Cfg('salt_roles', ct.JSONList(),
163 help="Node roles to install salt-minions and manage by salt",
164 default=[ext.UNDERLAY_NODE_ROLES.salt_master,
165 ext.UNDERLAY_NODE_ROLES.salt_minion,
166 ext.UNDERLAY_NODE_ROLES.k8s_controller]),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300167]
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200168salt_opts = [
169 ct.Cfg('salt_master_host', ct.IPAddress(),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300170 help="", default='0.0.0.0'),
Dennis Dmitriev2d60c8e2017-05-12 18:34:01 +0300171 ct.Cfg('salt_master_port', ct.String(),
172 help="", default='6969'),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300173]
174
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300175core_deploy_opts = [
176 ct.Cfg('core_steps_path', ct.String(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200177 help="Path to YAML with steps to deploy common services",
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300178 default=_default_core_steps),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300179]
180
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300181core_opts = [
182 ct.Cfg('core_installed', ct.Boolean(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200183 help="", default=False),
184]
185
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300186oss_deploy_opts = [
187 ct.Cfg('oss_steps_path', ct.String(),
188 help="Path to YAML with steps to deploy OSS Tools",
189 default=_default_oss_steps),
190]
191
192oss_opts = [
193 ct.Cfg('oss_installed', ct.Boolean(),
194 help="", default=False),
195]
196
sgudzb67ce732018-02-13 17:58:31 +0200197drivetrain_deploy_opts = [
198 ct.Cfg('drivetrain_steps_path', ct.String(),
199 help="Path to YAML with steps to deploy Drivetrain",
200 default=_default_drivetrain_steps),
201]
202
203drivetrain_opts = [
204 ct.Cfg('drivetrain_installed', ct.Boolean(),
205 help="", default=False),
206]
207
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300208decapod_deploy_opts = [
209 ct.Cfg('decapod_steps_path', ct.String(),
210 help="Path to YAML with steps to deploy Ceph with Decapod",
211 default=_default_decapod_steps),
212]
213
214decapod_opts = [
215 ct.Cfg('decapod_installed', ct.Boolean(),
216 help="", default=False),
217]
218
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200219openstack_deploy_opts = [
220 ct.Cfg('openstack_steps_path', ct.String(),
221 help="Path to YAML with steps to deploy openstack",
222 default=_default_openstack_steps),
Tatyana Leontovich8dbc7882018-08-29 13:11:16 +0300223 ct.Cfg('openstack_resources_steps_path', ct.String(),
224 help="Path to YAML with steps to deploy openstack",
225 default=_default_openstack_resources_steps),
Tatyana Leontovichc72604d2018-01-04 17:58:00 +0200226 ct.Cfg('horizon_host', ct.IPAddress(),
227 help="", default='0.0.0.0'),
228 ct.Cfg('horizon_port', ct.String(),
229 help="", default='5000'),
230 ct.Cfg('horizon_user', ct.String(),
231 help="", default='admin'),
232 ct.Cfg('horizon_password', ct.String(),
233 help="", default='workshop'),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200234]
235openstack_opts = [
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200236 ct.Cfg('openstack_installed', ct.Boolean(),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200237 help="", default=False),
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200238 ct.Cfg('openstack_keystone_endpoint', ct.String(),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300239 help="", default=''),
Tatyana Leontovichc08a54b2018-04-19 02:21:25 +0300240 ct.Cfg('horizon_check', ct.Boolean(),
Tatyana Leontovich69700712018-04-23 12:26:57 +0300241 help="", default=False),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300242]
243
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200244opencontrail_opts = [
245 ct.Cfg('opencontrail_tags', ct.String(),
246 help="", default=''),
247 ct.Cfg('opencontrail_features', ct.String(),
248 help="", default=''),
249 ct.Cfg('opencontrail_prepare_tests_steps_path', ct.String(),
250 help="Path to YAML with steps to prepare contrail-tests",
251 default=_default_opencontrail_prepare_tests_steps_path),
252]
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300253
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300254sl_deploy_opts = [
255 ct.Cfg('sl_steps_path', ct.String(),
256 help="Path to YAML with steps to deploy sl",
257 default=_default_sl_prepare_tests_steps_path),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300258 ct.Cfg('docker_image_alertmanager', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200259 default='{0}/openstack-docker/alertmanager:{1}'.format(
260 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Dmitry Kalashnik3eee60b2018-05-29 17:19:31 +0400261 ct.Cfg('docker_image_alerta', ct.String(),
262 default='{0}/mirantis/external/alerta-web:{1}'.format(
263 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300264 ct.Cfg('docker_image_pushgateway', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200265 default='{0}/openstack-docker/pushgateway:{1}'.format(
266 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300267 ct.Cfg('docker_image_prometheus', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200268 default='{0}/openstack-docker/prometheus:{1}'.format(
269 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300270 ct.Cfg('docker_image_remote_agent', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200271 default='{0}/openstack-docker/telegraf:{1}'.format(
272 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300273 ct.Cfg('docker_image_remote_storage_adapter', ct.String(),
Dennis Dmitriev257a9382018-02-15 04:00:46 +0200274 default='{0}/openstack-docker/remote_storage_adapter:{1}'.format(
275 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
276 ct.Cfg('docker_image_prometheus_relay', ct.String(),
277 default='{0}/openstack-docker/prometheus_relay:{1}'.format(
278 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
279 ct.Cfg('docker_image_grafana', ct.String(),
280 default='{0}/mirantis/external/grafana:{1}'.format(
281 settings.DOCKER_REGISTRY, settings.DOCKER_IMAGES_SL_TAG)),
Dennis Dmitriev86f63e82017-11-09 00:07:45 +0200282 # SalesForce connection options for pushkin
Dennis Dmitrievce5ed8b2017-11-09 00:44:19 +0200283 ct.Cfg('sfdc_sandbox_enabled', ct.String(), default='False'),
Dennis Dmitriev86f63e82017-11-09 00:07:45 +0200284 ct.Cfg('sfdc_auth_url', ct.String(), default=''),
285 ct.Cfg('sfdc_username', ct.String(), default=''),
286 ct.Cfg('sfdc_password', ct.String(), default=''),
287 ct.Cfg('sfdc_consumer_key', ct.String(), default=''),
288 ct.Cfg('sfdc_consumer_secret', ct.String(), default=''),
289 ct.Cfg('sfdc_organization_id', ct.String(), default=''),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300290]
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300291
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300292sl_opts = [
Dennis Dmitrievfde667f2018-07-23 16:26:50 +0300293 ct.Cfg('stacklight_installed', ct.Boolean(),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300294 help="", default=False),
sgudzbf4de572017-11-23 14:37:01 +0200295 ct.Cfg('sl_version', ct.String(),
296 help="StackLight version. Could be 1 or 2", default=''),
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300297 ct.Cfg('sl_vip_host', ct.IPAddress(),
298 help="Vip address for SL services", default='0.0.0.0'),
299 ct.Cfg('sl_prometheus_port', ct.String(),
300 help="Prometheus port", default='15010'),
301 ct.Cfg('sl_prometheus_proto', ct.String(),
302 help="Proemtheus protocol", default='http'),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300303]
304
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200305ceph_deploy_opts = [
306 ct.Cfg('ceph_steps_path', ct.String(),
307 help="Path to YAML with steps to deploy sl",
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200308 default=_default_ceph_prepare_tests_steps_path),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200309]
310
311ceph_opts = [
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200312 ct.Cfg('ceph_installed', ct.Boolean(),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200313 help="", default=False),
Tatyana Leontovich460f7df2017-11-13 15:45:06 +0200314]
315
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300316k8s_deploy_opts = [
Artem Panchenko0594cd72017-06-12 13:25:26 +0300317 ct.Cfg('k8s_steps_path', ct.String(),
318 help="Path to YAML with steps to deploy Kubernetes",
319 default=_default_k8s_steps),
Vladimir Jigulin62bcf462018-05-28 18:17:01 +0400320 ct.Cfg('k8s_update_steps_path', ct.String(),
321 help="Path to YAML with steps to update Kubernetes",
322 default=_default_k8s_update_steps),
Artem Panchenko0594cd72017-06-12 13:25:26 +0300323 ct.Cfg('kubernetes_admin_user', ct.String(), default='admin'),
324 ct.Cfg('kubernetes_admin_password', ct.String(),
325 default='sbPfel23ZigJF3Bm'),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300326 ct.Cfg('kubernetes_docker_package', ct.String(), default=''),
327 ct.Cfg('kubernetes_hyperkube_image', ct.String(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400328 default='{}/mirantis/kubernetes/hyperkube-amd64:v1.11.3-2'.format(
Victor Ryzhenkin2687fa12018-05-24 16:28:17 +0400329 settings.DOCKER_REGISTRY)),
330 ct.Cfg('kubernetes_pause_image', ct.String(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400331 default='{}/mirantis/kubernetes/pause-amd64:v1.11.3-2'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300332 settings.DOCKER_REGISTRY)),
333 ct.Cfg('kubernetes_calico_image', ct.String(),
Aleksei Kasatkin1d252f02018-08-29 13:15:58 +0200334 default='{}/mirantis/projectcalico/calico/node:v3.1.3'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300335 settings.DOCKER_REGISTRY)),
Victor Ryzhenkin53f1b492018-05-09 17:30:17 +0400336 ct.Cfg('kubernetes_calico_calicoctl_image', ct.String(),
Aleksei Kasatkin1d252f02018-08-29 13:15:58 +0200337 default='{}/mirantis/projectcalico/calico/ctl:v3.1.3'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300338 settings.DOCKER_REGISTRY)),
339 ct.Cfg('kubernetes_calico_cni_image', ct.String(),
Aleksei Kasatkin1d252f02018-08-29 13:15:58 +0200340 default='{}/mirantis/projectcalico/calico/cni:v3.1.3'.format(
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300341 settings.DOCKER_REGISTRY)),
Aleksei Kasatkin1d252f02018-08-29 13:15:58 +0200342 ct.Cfg('kubernetes_calico_kube_controllers_image', ct.String(),
343 default='{}/mirantis/projectcalico/calico/kube-controllers:'
344 'v3.1.3'.format(settings.DOCKER_REGISTRY)),
Artem Panchenko0594cd72017-06-12 13:25:26 +0300345 ct.Cfg('kubernetes_netchecker_enabled', ct.Boolean(),
346 help="", default=True),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300347 ct.Cfg('kubernetes_netchecker_agent_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200348 default='mirantis/k8s-netchecker-agent:v1.2.2'),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300349 ct.Cfg('kubernetes_netchecker_server_image', ct.String(),
Aleksei Kasatkin593596f2018-05-14 11:02:19 +0200350 default='mirantis/k8s-netchecker-server:v1.2.2'),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300351 ct.Cfg('kubernetes_calico_policy_enabled', ct.Boolean(),
352 help="", default=False),
Artem Panchenko501e67e2017-06-14 14:59:18 +0300353 ct.Cfg('kubernetes_helm_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300354 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400355 ct.Cfg('kubernetes_virtlet_enabled', ct.Boolean(),
Tatyana Leontovich038dc7d2017-09-22 16:25:59 +0300356 help="", default=False),
Victor Ryzhenkin0bf0bb02017-07-06 18:57:05 +0400357 ct.Cfg('kubernetes_virtlet_image', ct.String(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400358 help="", default='mirantis/virtlet:v1.4.1'),
Victor Ryzhenkin5902ae62018-09-11 20:34:54 +0400359 ct.Cfg('kubernetes_dns', ct.Boolean(),
360 help="", default=True),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400361 ct.Cfg('kubernetes_externaldns_enabled', ct.Boolean(),
362 help="", default=False),
363 ct.Cfg('kubernetes_externaldns_image', ct.String(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400364 help="", default='{}/mirantis/external-dns/external-dns:'
365 'v0.5.6-2'.format(settings.DOCKER_REGISTRY)),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400366 ct.Cfg('kubernetes_externaldns_provider', ct.String(),
367 help="", default='coredns'),
368 ct.Cfg('kubernetes_coredns_enabled', ct.Boolean(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400369 help="", default=True),
Vladimir Jigulina6b018b2018-07-18 15:19:01 +0400370 ct.Cfg('kubernetes_metallb_enabled', ct.Boolean(),
371 help="", default=False),
Vladimir Jigulin5775bbb2018-10-03 10:34:54 +0400372 ct.Cfg('kubernetes_ingressnginx_enabled', ct.Boolean(),
373 help="", default=False),
Victor Ryzhenkin2a5806e2017-12-18 20:23:53 +0400374 ct.Cfg('kubelet_fail_on_swap', ct.Boolean(),
Victor Ryzhenkin14354ac2017-09-27 17:42:30 +0400375 help="", default=False)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300376]
377
378k8s_opts = [
Artem Panchenko0594cd72017-06-12 13:25:26 +0300379 ct.Cfg('k8s_installed', ct.Boolean(),
380 help="", default=False),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300381 ct.Cfg('kube_host', ct.IPAddress(),
382 help="", default='0.0.0.0'),
383 ct.Cfg('kube_apiserver_port', ct.Integer(),
384 help="", default=443),
vrovacheva9d08332017-06-22 20:01:59 +0400385 ct.Cfg("k8s_conformance_run", ct.Boolean(),
386 default=False),
Victor Ryzhenkin8ff3c3f2018-01-17 19:37:05 +0400387 ct.Cfg("run_extended_virtlet_conformance", ct.Boolean(),
388 default=False),
vrovacheva9d08332017-06-22 20:01:59 +0400389 ct.Cfg('k8s_conformance_image', ct.String(),
Dennis Dmitriev75776c52017-12-26 18:22:53 +0200390 default='docker-prod-virtual.docker.mirantis.net/mirantis/'
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400391 'kubernetes/k8s-conformance:v1.11.3-2'),
Vladimir Jigulin62bcf462018-05-28 18:17:01 +0400392 ct.Cfg('k8s_update_chain', ct.String(),
Victor Ryzhenkin3bcb0742018-10-16 15:55:04 +0400393 default='v1.9.8-4 v1.10.4-4 v1.11.3-2')
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300394]
395
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200396day1_cfg_config_opts = [
397 ct.Cfg('configure_steps_path', ct.String(),
398 help="Path to YAML with steps to config cfg01 node",
399 default=_default_configure_steps),
400 ct.Cfg('environment_template_dir', ct.String(),
401 help="Path to directory with Environment template and inventory",
402 default=_default_environment_template_dir),
403 ct.Cfg('templates_dir', ct.String(),
404 help="Path to directory with templates",
405 default=_default_templates_dir),
406 ct.Cfg('cluster_maas_config', ct.String(),
407 help="Path to maas class yaml file for cfg node",
408 default=_default_cluster_maas_config),
409 ct.Cfg('maas_machines_macs', ct.JSONDict(),
410 help="""MAC of machines interfaces for maas config:
411 'parameters': {
412 'maas' : {
413 'region' : {
414 'machines': {
415 'ctl01': {
416 'interface': {
417 'mac': 'aa:bb:cc:dd:ee:ff'
418 }
419 }
420 '...': {
421 'interface': {
422 'mac': 'aa:bb:cc:dd:ee:ff'
423 }
424 }
425 }}}}""", default={}),
426]
427
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300428_group_opts = [
429 ('hardware', hardware_opts),
430 ('underlay', underlay_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200431 ('salt_deploy', salt_deploy_opts),
432 ('salt', salt_opts),
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300433 ('core_deploy', core_deploy_opts),
434 ('core', core_opts),
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300435 ('oss_deploy', oss_deploy_opts),
436 ('oss', oss_opts),
sgudzb67ce732018-02-13 17:58:31 +0200437 ('drivetrain_deploy', drivetrain_deploy_opts),
438 ('drivetrain', drivetrain_opts),
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300439 ('decapod_deploy', decapod_deploy_opts),
440 ('decapod', decapod_opts),
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200441 ('openstack_deploy', openstack_deploy_opts),
442 ('openstack', openstack_opts),
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200443 ('opencontrail', opencontrail_opts),
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300444 ('stack_light', sl_opts),
445 ('sl_deploy', sl_deploy_opts),
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200446 ('ceph', ceph_opts),
447 ('ceph_deploy', ceph_deploy_opts),
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300448 ('k8s_deploy', k8s_deploy_opts),
449 ('k8s', k8s_opts),
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200450 ('day1_cfg_config', day1_cfg_config_opts),
451 ('day1_underlay', underlay_opts),
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300452]
453
454
455def register_opts(config):
456 config.register_group(cfg.OptGroup(name='hardware',
457 title="Hardware settings", help=""))
458 config.register_opts(group='hardware', opts=hardware_opts)
459
460 config.register_group(cfg.OptGroup(name='underlay',
461 title="Underlay configuration", help=""))
462 config.register_opts(group='underlay', opts=underlay_opts)
463
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200464 config.register_group(cfg.OptGroup(name='salt_deploy',
465 title="salt deploy configuration", help=""))
466 config.register_opts(group='salt_deploy', opts=salt_deploy_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300467
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200468 config.register_group(cfg.OptGroup(name='salt',
469 title="salt config and credentials", help=""))
470 config.register_opts(group='salt', opts=salt_opts)
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300471
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300472 config.register_group(cfg.OptGroup(name='core',
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200473 title="Common services for Openstack", help=""))
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300474 config.register_opts(group='core', opts=core_opts)
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200475
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300476 config.register_group(
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300477 cfg.OptGroup(name='core_deploy',
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200478 title="Common services for Openstack deploy config",
479 help=""))
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300480 config.register_opts(group='core_deploy',
481 opts=core_deploy_opts)
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200482
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300483 config.register_group(cfg.OptGroup(name='oss',
484 title="Operational Support System Tools", help=""))
485 config.register_opts(group='oss', opts=oss_opts)
486
487 config.register_group(cfg.OptGroup(name='oss_deploy',
488 title="OSS deploy config", help=""))
489 config.register_opts(group='oss_deploy',
490 opts=oss_deploy_opts)
491
sgudzb67ce732018-02-13 17:58:31 +0200492 config.register_group(cfg.OptGroup(name='drivetrain',
493 title="Drivetrain Tools", help=""))
494 config.register_opts(group='drivetrain', opts=drivetrain_opts)
495
496 config.register_group(cfg.OptGroup(name='drivetrain_deploy',
497 title="Drivetrain deploy config", help=""))
498 config.register_opts(group='drivetrain_deploy',
499 opts=drivetrain_deploy_opts)
500
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300501 config.register_group(cfg.OptGroup(name='decapod',
502 title="Decapod options for Ceph", help=""))
503 config.register_opts(group='decapod', opts=decapod_opts)
504
505 config.register_group(cfg.OptGroup(name='decapod_deploy',
506 title="Decapod deploy config", help=""))
507 config.register_opts(group='decapod_deploy',
508 opts=decapod_deploy_opts)
509
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200510 config.register_group(cfg.OptGroup(name='openstack',
511 title="Openstack config and credentials", help=""))
512 config.register_opts(group='openstack', opts=openstack_opts)
513
514 config.register_group(
515 cfg.OptGroup(name='openstack_deploy',
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300516 title="Openstack deploy config and credentials",
517 help=""))
Dennis Dmitriev6860ba62016-11-01 21:43:46 +0200518 config.register_opts(group='openstack_deploy', opts=openstack_deploy_opts)
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +0200519
520 config.register_group(cfg.OptGroup(name='opencontrail',
521 title="Options for Juniper contrail-tests", help=""))
522 config.register_opts(group='opencontrail', opts=opencontrail_opts)
Dmitry Tyzhnenko8f6a63e2017-09-05 15:37:23 +0300523 config.register_group(
524 cfg.OptGroup(name='stack_light',
525 title="StackLight config and credentials", help=""))
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300526 config.register_opts(group='stack_light', opts=sl_opts)
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300527 config.register_group(
528 cfg.OptGroup(name='sl_deploy',
Dennis Dmitrievf3f90a52017-08-10 14:37:05 +0300529 title="SL deploy config and credentials",
530 help=""))
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +0300531 config.register_opts(group='sl_deploy', opts=sl_deploy_opts)
Artem Panchenkoedf70ef2017-06-13 09:14:34 +0300532
533 config.register_group(cfg.OptGroup(name='k8s_deploy',
534 title="K8s deploy configuration"))
535 config.register_opts(group='k8s_deploy', opts=k8s_deploy_opts)
536
537 config.register_group(cfg.OptGroup(name='k8s',
538 title="K8s config and credentials"))
539 config.register_opts(group='k8s', opts=k8s_opts)
Tatyana Leontovicha754ce52017-11-13 16:46:43 +0200540 config.register_group(cfg.OptGroup(name='ceph',
541 title="ceph config", help=""))
542 config.register_opts(group='ceph', opts=ceph_opts)
543
544 config.register_group(
545 cfg.OptGroup(name='ceph_deploy',
546 title="Ceph deploy config ",
547 help=""))
548 config.register_opts(group='ceph_deploy', opts=ceph_deploy_opts)
549
Dmitry Tyzhnenko35413c02018-03-05 14:12:37 +0200550 config.register_group(cfg.OptGroup(name='day1_cfg_config',
551 title="Day01 config node configuration", help=""))
552 config.register_opts(group='day1_cfg_config', opts=day1_cfg_config_opts)
553
554 config.register_group(cfg.OptGroup(name='day1_underlay',
555 title="Day01 underlay configuration", help=""))
556 config.register_opts(group='day1_underlay', opts=underlay_opts)
557
Dennis Dmitriev6f59add2016-10-18 13:45:27 +0300558 return config
559
560
561def load_config(config_files):
562 config = cfg.CONF
563 register_opts(config)
564 config(args=[], default_config_files=config_files)
565 return config
566
567
568def reload_snapshot_config(config, test_config_path):
569 """Reset config to the state from test_config file"""
570 config(args=[], default_config_files=[test_config_path])
571 return config
572
573
574def list_opts():
575 """Return a list of oslo.config options available in the tcp_tests.
576 """
577 return [(group, copy.deepcopy(opts)) for group, opts in _group_opts]
578
579
580def list_current_opts(config):
581 """Return a list of oslo.config options available in the tcp_tests.
582 """
583 result_opts = []
584 for group, opts in _group_opts:
585 current_opts = copy.deepcopy(opts)
586 for opt in current_opts:
587 if hasattr(config, group):
588 if hasattr(config[group], opt.name):
589 opt.default = getattr(config[group], opt.name)
590 result_opts.append((group, current_opts))
591 return result_opts
592
593
594def save_config(config, snapshot_name, env_name=None):
595 if env_name is None:
596 env_name = 'config'
597 test_config_path = os.path.join(
598 settings.LOGS_DIR, '{0}_{1}.ini'.format(env_name, snapshot_name))
599
600 with open(test_config_path, 'w') as output_file:
601 formatter = generator._OptFormatter(output_file=output_file)
602 for group, opts in list_current_opts(config):
603 formatter.format_group(group)
604 for opt in opts:
605 formatter.format(opt, group, minimal=True)
606 formatter.write('\n')
607 formatter.write('\n')