|
8 | 8 |
|
9 | 9 | from ocs_ci.framework import config |
10 | 10 | from ocs_ci.ocs import constants, ocp, defaults |
| 11 | +from ocs_ci.ocs.constants import ( |
| 12 | + OCS_STORAGE_CLUSTER_CONVERGED_YAML, |
| 13 | + OCS_STORAGE_CLUSTER_YAML, |
| 14 | + OCS_STORAGE_CLUSTER_UPDATED_YAML, |
| 15 | +) |
11 | 16 | from ocs_ci.ocs.rados_utils import ( |
12 | 17 | verify_cephblockpool_status, |
13 | 18 | check_phase_of_rados_namespace, |
@@ -175,10 +180,7 @@ def provider_and_native_client_installation( |
175 | 180 | timeout=600, |
176 | 181 | ) |
177 | 182 |
|
178 | | - if ( |
179 | | - self.ocs_version < version.VERSION_4_16 |
180 | | - and self.ocs_version >= version.VERSION_4_14 |
181 | | - ): |
| 183 | + if self.ocs_version in [version.VERSION_4_14, version.VERSION_4_15]: |
182 | 184 | # Disable ROOK_CSI_ENABLE_CEPHFS and ROOK_CSI_ENABLE_RBD |
183 | 185 | disable_CEPHFS_RBD_CSI = '{"data":{"ROOK_CSI_ENABLE_CEPHFS":"false", "ROOK_CSI_ENABLE_RBD":"false"}}' |
184 | 186 | assert self.config_map_obj.patch( |
@@ -210,58 +212,45 @@ def provider_and_native_client_installation( |
210 | 212 | resource_name=constants.DEFAULT_STORAGE_CLUSTER |
211 | 213 | ) |
212 | 214 | if not is_storagecluster: |
213 | | - if ( |
214 | | - self.ocs_version < version.VERSION_4_16 |
215 | | - and self.ocs_version >= version.VERSION_4_14 |
216 | | - ): |
217 | | - storage_cluster_data = templating.load_yaml( |
218 | | - constants.OCS_STORAGE_CLUSTER_YAML |
219 | | - ) |
220 | | - storage_cluster_data = add_encryption_details_to_cluster_data( |
221 | | - storage_cluster_data |
222 | | - ) |
223 | | - storage_cluster_data = add_in_transit_encryption_to_cluster_data( |
224 | | - storage_cluster_data |
225 | | - ) |
226 | | - storage_cluster_data["spec"]["storageDeviceSets"][0][ |
227 | | - "replica" |
228 | | - ] = no_of_worker_nodes |
229 | | - |
230 | | - if self.platform in constants.HCI_PROVIDER_CLIENT_PLATFORMS: |
231 | | - storage_cluster_data["spec"]["storageDeviceSets"][0][ |
232 | | - "count" |
233 | | - ] = number_of_disks_available |
234 | 215 |
|
235 | | - templating.dump_data_to_temp_yaml( |
236 | | - storage_cluster_data, constants.OCS_STORAGE_CLUSTER_YAML |
237 | | - ) |
238 | | - self.ocp_obj.exec_oc_cmd( |
239 | | - f"apply -f {constants.OCS_STORAGE_CLUSTER_YAML}" |
240 | | - ) |
| 216 | + # define storage cluster path to cr, based on ocs version |
| 217 | + if self.ocs_version in [version.VERSION_4_14, version.VERSION_4_15]: |
| 218 | + storage_cluster_path = OCS_STORAGE_CLUSTER_YAML |
| 219 | + elif self.ocs_version in [ |
| 220 | + version.VERSION_4_16, |
| 221 | + version.VERSION_4_17, |
| 222 | + version.VERSION_4_18, |
| 223 | + ]: |
| 224 | + storage_cluster_path = OCS_STORAGE_CLUSTER_UPDATED_YAML |
241 | 225 | else: |
242 | | - storage_cluster_data = templating.load_yaml( |
243 | | - constants.OCS_STORAGE_CLUSTER_UPDATED_YAML |
244 | | - ) |
245 | | - storage_cluster_data = add_encryption_details_to_cluster_data( |
246 | | - storage_cluster_data |
247 | | - ) |
248 | | - storage_cluster_data = add_in_transit_encryption_to_cluster_data( |
249 | | - storage_cluster_data |
250 | | - ) |
| 226 | + storage_cluster_path = OCS_STORAGE_CLUSTER_CONVERGED_YAML |
| 227 | + storage_cluster_data = templating.load_yaml(storage_cluster_path) |
| 228 | + |
| 229 | + # configure storage cluster data based on platform and configuration |
| 230 | + storage_cluster_data = add_encryption_details_to_cluster_data( |
| 231 | + storage_cluster_data |
| 232 | + ) |
| 233 | + storage_cluster_data = add_in_transit_encryption_to_cluster_data( |
| 234 | + storage_cluster_data |
| 235 | + ) |
| 236 | + storage_cluster_data["spec"]["storageDeviceSets"][0][ |
| 237 | + "replica" |
| 238 | + ] = no_of_worker_nodes |
| 239 | + |
| 240 | + if self.platform in constants.HCI_PROVIDER_CLIENT_PLATFORMS: |
251 | 241 | storage_cluster_data["spec"]["storageDeviceSets"][0][ |
252 | | - "replica" |
253 | | - ] = no_of_worker_nodes |
| 242 | + "count" |
| 243 | + ] = number_of_disks_available |
254 | 244 |
|
255 | | - if self.platform in constants.HCI_PROVIDER_CLIENT_PLATFORMS: |
256 | | - storage_cluster_data["spec"]["storageDeviceSets"][0][ |
257 | | - "count" |
258 | | - ] = number_of_disks_available |
259 | | - templating.dump_data_to_temp_yaml( |
260 | | - storage_cluster_data, constants.OCS_STORAGE_CLUSTER_UPDATED_YAML |
261 | | - ) |
262 | | - self.ocp_obj.exec_oc_cmd( |
263 | | - f"apply -f {constants.OCS_STORAGE_CLUSTER_UPDATED_YAML}" |
264 | | - ) |
| 245 | + # configure dynamic namespace |
| 246 | + storage_cluster_data["metadata"]["namespace"] = config.ENV_DATA[ |
| 247 | + "cluster_namespace" |
| 248 | + ] |
| 249 | + |
| 250 | + templating.dump_data_to_temp_yaml( |
| 251 | + storage_cluster_data, storage_cluster_path |
| 252 | + ) |
| 253 | + self.ocp_obj.exec_oc_cmd(f"apply -f {storage_cluster_path}") |
265 | 254 |
|
266 | 255 | # Creating toolbox pod |
267 | 256 | setup_ceph_toolbox() |
|
0 commit comments