Skip to content

Commit 83c5ba8

Browse files
DisableStorageClass and DisableSnapshotClass fields are deprecated
Signed-off-by: Daniel Osypenko <dosypenk@redhat.com>
1 parent c181f06 commit 83c5ba8

File tree

3 files changed

+94
-52
lines changed

3 files changed

+94
-52
lines changed

ocs_ci/deployment/provider_client/storage_client_deployment.py

Lines changed: 41 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
from ocs_ci.framework import config
1010
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+
)
1116
from ocs_ci.ocs.rados_utils import (
1217
verify_cephblockpool_status,
1318
check_phase_of_rados_namespace,
@@ -175,10 +180,7 @@ def provider_and_native_client_installation(
175180
timeout=600,
176181
)
177182

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]:
182184
# Disable ROOK_CSI_ENABLE_CEPHFS and ROOK_CSI_ENABLE_RBD
183185
disable_CEPHFS_RBD_CSI = '{"data":{"ROOK_CSI_ENABLE_CEPHFS":"false", "ROOK_CSI_ENABLE_RBD":"false"}}'
184186
assert self.config_map_obj.patch(
@@ -210,58 +212,45 @@ def provider_and_native_client_installation(
210212
resource_name=constants.DEFAULT_STORAGE_CLUSTER
211213
)
212214
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
234215

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
241225
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:
251241
storage_cluster_data["spec"]["storageDeviceSets"][0][
252-
"replica"
253-
] = no_of_worker_nodes
242+
"count"
243+
] = number_of_disks_available
254244

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}")
265254

266255
# Creating toolbox pod
267256
setup_ceph_toolbox()

ocs_ci/ocs/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@
356356
OCS_STORAGE_CLUSTER_YAML = os.path.join(
357357
PROVIDER_MODE_OCS_DEPLOYMENT_PATH, "ocs_storagecluster.yaml"
358358
)
359+
OCS_STORAGE_CLUSTER_CONVERGED_YAML = os.path.join(
360+
PROVIDER_MODE_OCS_DEPLOYMENT_PATH, "ocs_storagecluster_converged.yaml"
361+
)
359362
OCS_STORAGE_CLUSTER_UPDATED_YAML = os.path.join(
360363
PROVIDER_MODE_OCS_DEPLOYMENT_PATH, "ocs_storagecluster_updated.yaml"
361364
)
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
apiVersion: ocs.openshift.io/v1
2+
kind: StorageCluster
3+
metadata:
4+
name: ocs-storagecluster
5+
namespace: openshift-storage
6+
spec:
7+
allowRemoteStorageConsumers: true
8+
arbiter: {}
9+
encryption:
10+
kms: {}
11+
externalStorage: {}
12+
flexibleScaling: true
13+
hostNetwork: true
14+
managedResources:
15+
cephBlockPools: {}
16+
cephCluster: {}
17+
cephConfig: {}
18+
cephDashboard: {}
19+
cephFilesystems: {}
20+
cephNonResilientPools: {}
21+
cephObjectStoreUsers: {}
22+
cephObjectStores:
23+
hostNetwork: false
24+
cephRBDMirror: {}
25+
cephToolbox: {}
26+
mirroring: {}
27+
monDataDirHostPath: /var/lib/rook
28+
nodeTopologies: {}
29+
providerAPIServerServiceType: NodePort
30+
storageDeviceSets:
31+
- config: {}
32+
count: 4
33+
dataPVCTemplate:
34+
metadata: {}
35+
spec:
36+
accessModes:
37+
- ReadWriteOnce
38+
resources:
39+
requests:
40+
storage: 256Gi
41+
storageClassName: localblock
42+
43+
volumeMode: Block
44+
status: {}
45+
deviceClass: ssd
46+
name: local-storage-deviceset
47+
placement: {}
48+
preparePlacement: {}
49+
replica: 3
50+
resources: {}

0 commit comments

Comments
 (0)