forked from RedHatQE/openshift-virtualization-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobal_config.py
More file actions
259 lines (224 loc) · 7.96 KB
/
Copy pathglobal_config.py
File metadata and controls
259 lines (224 loc) · 7.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
from typing import Any
import pytest_testconfig
from ocp_resources.datavolume import DataVolume
from ocp_resources.deployment import Deployment
from ocp_resources.virtual_machine import VirtualMachine
from utilities.architecture import get_cluster_architecture
from utilities.artifactory import BASE_ARTIFACTORY_LOCATION
from utilities.constants import (
AAQ_VIRTUAL_RESOURCES,
AAQ_VMI_POD_USAGE,
ALL_CNV_CRDS,
ALL_CNV_DAEMONSETS,
ALL_CNV_DEPLOYMENTS,
ALL_CNV_PODS,
ALL_HCO_RELATED_OBJECTS,
BREW_REGISTERY_SOURCE,
CENTOS_STREAM9_PREFERENCE,
CENTOS_STREAM10_PREFERENCE,
CNV_OPERATORS,
CNV_PROMETHEUS_RULES,
HCO_CATALOG_SOURCE,
HPP_CAPABILITIES,
LINUX_BRIDGE,
MONITORING_METRICS,
OS_FLAVOR_FEDORA,
OVS_BRIDGE,
PRODUCTION_CATALOG_SOURCE,
RHEL8_PREFERENCE,
RHEL9_PREFERENCE,
RHEL10_PREFERENCE,
TEKTON_AVAILABLE_PIPELINEREF,
TEKTON_AVAILABLE_TASKS,
TIMEOUT_5MIN,
TIMEOUT_5SEC,
TLS_CUSTOM_POLICY,
TLS_OLD_POLICY,
U1_MEDIUM_STR,
VM_CONSOLE_PROXY_CLUSTER_RESOURCES,
VM_CONSOLE_PROXY_NAMESPACE_RESOURCES,
Images,
NamespacesNames,
StorageClassNames,
)
from utilities.storage import HppCsiStorageClass
arch = get_cluster_architecture()
global config
global_config = pytest_testconfig.load_python(py_file=f"tests/global_config_{arch}.py", encoding="utf-8")
def _get_default_storage_class(sc_list):
"""
Args:
sc_list (list): storage class dict - a list of dicts
Returns:
tuple: (default storage class name, default storage class dict) else raises an exception.
"""
for sc_dict in sc_list:
for sc_name, sc_values in sc_dict.items():
if sc_values.get("default"):
return sc_name, sc_values
assert False, f"No SC is marked as 'default': {sc_list}"
no_unprivileged_client = False
hco_cr_name = "kubevirt-hyperconverged"
hco_namespace = "openshift-cnv"
openshift_apiserver_namespace = "openshift-apiserver"
sriov_namespace = "openshift-sriov-network-operator"
marketplace_namespace = "openshift-marketplace"
machine_api_namespace = "openshift-machine-api"
golden_images_namespace = NamespacesNames.OPENSHIFT_VIRTUALIZATION_OS_IMAGES
hco_subscription = "" # TODO: remove constants/HCO_SUBSCRIPTION and use this instead.
disconnected_cluster = False
linux_bridge_cni = "cnv-bridge"
bridge_tuning = "cnv-tuning"
version_explorer_url = ""
server_url = "" # Send --tc=server_url:<url> to override servers URL
servers = {
"https_server": f"https://{{server}}/{BASE_ARTIFACTORY_LOCATION}/",
"registry_server": "docker://{server}",
}
cnv_registry_sources = {
"osbs": {
"cnv_subscription_source": HCO_CATALOG_SOURCE,
"source_map": BREW_REGISTERY_SOURCE,
},
"hotfix": {
"cnv_subscription_source": HCO_CATALOG_SOURCE,
},
"production": {
"cnv_subscription_source": PRODUCTION_CATALOG_SOURCE,
},
"fbc": {
"cnv_subscription_source": HCO_CATALOG_SOURCE,
"source_map": BREW_REGISTERY_SOURCE,
},
}
cnv_vm_resources_limits_matrix = [
"cpu",
"memory",
]
nic_models_matrix = [
"virtio",
"e1000e",
]
cnv_must_gather_matrix = [
"cnv-gather",
"all-images",
]
cnv_vm_resource_requests_units_matrix = [
"cores",
"sockets",
"threads",
]
cnv_vmi_monitoring_metrics_matrix = MONITORING_METRICS
bridge_device_matrix = [LINUX_BRIDGE, OVS_BRIDGE]
storage_class_matrix = [
{
StorageClassNames.CEPH_RBD_VIRTUALIZATION: {
"volume_mode": DataVolume.VolumeMode.BLOCK,
"access_mode": DataVolume.AccessMode.RWX,
"snapshot": True,
"online_resize": True,
"wffc": False,
"default": True,
}
},
{HppCsiStorageClass.Name.HOSTPATH_CSI_BASIC: HPP_CAPABILITIES},
{HppCsiStorageClass.Name.HOSTPATH_CSI_PVC_BLOCK: HPP_CAPABILITIES},
]
default_storage_class, default_storage_class_configuration = _get_default_storage_class(sc_list=storage_class_matrix)
default_volume_mode = default_storage_class_configuration["volume_mode"]
default_access_mode = default_storage_class_configuration["access_mode"]
storage_class_a = HppCsiStorageClass.Name.HOSTPATH_CSI_BASIC
storage_class_b = StorageClassNames.CEPH_RBD_VIRTUALIZATION
link_aggregation_mode_matrix = [
"active-backup",
"balance-tlb",
"balance-alb",
]
link_aggregation_mode_no_connectivity_matrix = [
"balance-xor",
"802.3ad",
]
vm_volumes_matrix = ["container_disk_vm", "data_volume_vm"]
run_strategy_matrix = [
VirtualMachine.RunStrategy.MANUAL,
VirtualMachine.RunStrategy.ALWAYS,
VirtualMachine.RunStrategy.HALTED,
VirtualMachine.RunStrategy.RERUNONFAILURE,
]
aaq_allocation_methods_matrix = [AAQ_VIRTUAL_RESOURCES, AAQ_VMI_POD_USAGE]
sysprep_source_matrix = ["ConfigMap", "Secret"]
# If the DataImportCron uses a different prefix than the DataSource name
# use data_import_cron_prefix in matrix dict to specify new prefix.
auto_update_data_source_matrix = [
{"centos-stream9": {"template_os": "centos-stream9"}},
{"fedora": {"template_os": "fedora"}},
{"rhel8": {"template_os": "rhel8.4"}},
{"rhel9": {"template_os": "rhel9.0"}},
]
data_import_cron_matrix = [
{"centos-stream9": {"instance_type": U1_MEDIUM_STR, "preference": CENTOS_STREAM9_PREFERENCE}},
{"centos-stream10": {"instance_type": U1_MEDIUM_STR, "preference": CENTOS_STREAM10_PREFERENCE}},
{"fedora": {"instance_type": U1_MEDIUM_STR, "preference": OS_FLAVOR_FEDORA}},
{"rhel8": {"instance_type": U1_MEDIUM_STR, "preference": RHEL8_PREFERENCE}},
{"rhel9": {"instance_type": U1_MEDIUM_STR, "preference": RHEL9_PREFERENCE}},
{"rhel10": {"instance_type": U1_MEDIUM_STR, "preference": RHEL10_PREFERENCE}},
]
cnv_pod_matrix = ALL_CNV_PODS
cnv_crd_matrix = ALL_CNV_CRDS
cnv_crypto_policy_matrix = [TLS_OLD_POLICY, TLS_CUSTOM_POLICY]
cnv_related_object_matrix = ALL_HCO_RELATED_OBJECTS
cnv_prometheus_rules_matrix = CNV_PROMETHEUS_RULES
cnv_deployment_matrix = ALL_CNV_DEPLOYMENTS
cnv_daemonset_matrix = ALL_CNV_DAEMONSETS
pod_resource_validation_matrix = [{"cpu": 5}, {"memory": None}]
cnv_operators_matrix = CNV_OPERATORS
cnv_vm_console_proxy_cluster_resource_matrix = VM_CONSOLE_PROXY_CLUSTER_RESOURCES
cnv_vm_console_proxy_namespace_resource_matrix = VM_CONSOLE_PROXY_NAMESPACE_RESOURCES
# VM migration storm test params
vm_deploys = 1 # How many vm of each type to deploy
linux_iterations = 250 # Number of migration iterations of linux VMs
windows_iterations = 500 # Number of migration iterations of windows VMs
# RHEL container disk image matrix
cnv_rhel_container_disk_images_matrix = [
{"rhel8": {"RHEL_CONTAINER_DISK_IMAGE": getattr(Images.Rhel, "RHEL8_REGISTRY_GUEST_IMG", None)}},
{"rhel9": {"RHEL_CONTAINER_DISK_IMAGE": getattr(Images.Rhel, "RHEL9_REGISTRY_GUEST_IMG", None)}},
{"rhel10": {"RHEL_CONTAINER_DISK_IMAGE": getattr(Images.Rhel, "RHEL10_REGISTRY_GUEST_IMG", None)}},
]
# Tekton resource matrix
cnv_tekton_pipelines_resource_matrix = TEKTON_AVAILABLE_PIPELINEREF
cnv_tekton_tasks_resource_matrix = TEKTON_AVAILABLE_TASKS
# Pod matrix for chaos
cnv_pod_deletion_test_matrix = [
{
"virt-api": {
"pod_prefix": "virt-api",
"resource": Deployment,
"namespace_name": hco_namespace,
"ratio": 0.5,
"interval": TIMEOUT_5SEC,
"max_duration": TIMEOUT_5MIN,
}
},
{
"apiserver": {
"pod_prefix": "apiserver",
"resource": Deployment,
"namespace_name": openshift_apiserver_namespace,
"ratio": 0.5,
"interval": TIMEOUT_5SEC,
"max_duration": TIMEOUT_5MIN,
}
},
]
os_login_param: dict[str, Any] = {}
# Network configuration
vlans = [f"{_id}" for _id in range(1000, 1020)]
for _dir in dir():
if not config: # noqa: F821
config: dict[str, Any] = {}
val = locals()[_dir]
if type(val) not in [bool, list, dict, str, int]:
continue
if _dir in ["encoding", "py_file"]:
continue
config[_dir] = locals()[_dir]