Skip to content

Commit

Permalink
addressed review comments
Browse files Browse the repository at this point in the history
Signed-off-by: nagendra202 <[email protected]>
  • Loading branch information
nagendra202 committed Dec 12, 2024
1 parent 016ba68 commit c5068f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 34 deletions.
21 changes: 0 additions & 21 deletions ocs_ci/helpers/keyrotation_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,27 +422,6 @@ def wait_till_keyrotation(self, device_handle):
return True


def enable_key_rotation():
"""
Enable Key rotation and verify its status for Noobaa and Storage cluster.
"""
osd_keyrotation = OSDKeyrotation()
noobaa_keyrotation = NoobaaKeyrotation()
osd_keyrotation.enable_keyrotation()
noobaa_keyrotation.enable_keyrotation()

assert (
osd_keyrotation.is_keyrotation_enable()
), "Encryption Key rotation is not enabled for OSDs"
assert (
noobaa_keyrotation.is_keyrotation_enable
), "Keyrotation is not enabled in the storagecluster object."
assert (
noobaa_keyrotation.is_noobaa_keyrotation_enable
), "Keyrotation is not enabled in the noobaa object."


def verify_key_rotation_time(schedule):
"""
Verify Key rotation schedule changed at storage cluster, rook and Noobaa object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
)
from ocs_ci.helpers.keyrotation_helper import (
verify_key_rotation_time,
enable_key_rotation,
verify_new_key_after_rotation,
OSDKeyrotation,
)
Expand Down Expand Up @@ -55,7 +54,6 @@ def test_cluster_wide_encryption_key_rotation_system(
teardown_project_factory,
pvc_factory,
pod_factory,
threading_lock,
bucket_factory_session,
mcg_obj_session,
noobaa_db_backup_and_recovery_locally,
Expand All @@ -64,31 +62,29 @@ def test_cluster_wide_encryption_key_rotation_system(
warps3,
):
"""
1. Set cluster wide keyrotation period to every 5 mins by editing storage cluster and capture the keys details
for OSDs, Noobaa.
2. Set custom taints to all the worker nodes and make sure #1 and #2 still exists after rebooting the pods.
1. Function OSDKeyrotation().set_keyrotation_schedule is to set cluster wide keyrotation period to every 5 mins
2. Using verify_new_key_after_rotation function to Capture the keys details and verify new keys
after the scheduled time.
3. Set custom taints to all the worker nodes and make sure #1 and #2 still exists after rebooting the pods.
a) Apply custom taint to all nodes
b) Add toleration in storagecluster CR and odf-operator subscription.
c) Verify toleration applied in ODF subscription and Storage Cluster CR are reflecting for other
subscriptions ,Ceph and nooba components or not.
d) Verify the pods in all nodes are running as per taints applied.
e) Restart all ocs the pods on all nodes.
3. Fill the cluster till the full ratio limits (85%) by running IO from multiple pods and verify key rotation.
4. Once the cluster reaches read-only state, resize the OSD and verify key rotation.
5. Run noobaa_rebuild test and verify key rotation still works as it is.
6. Run noobaa-db backup and recovery locally. Verify key rotation.
4. Fill the cluster till the full ratio limits (85%) by running FIO from multiple pods and verify key rotation.
5. Once the cluster reaches read-only state, resize the OSD using basic_resize_osd and verify key rotation.
6. Run validate_noobaa_rebuild_system function to verify key rotation still works as it is afetr nobba rebuild.
7. Run validate_noobaa_db_backup_recovery_locally_system and verify key rotation.
"""
time_interval_to_rotate_key_in_minutes = str(5)
tries = 10
delays = int(time_interval_to_rotate_key_in_minutes) * 60 / tries
schedule = f"*/{time_interval_to_rotate_key_in_minutes} * * * *"
log.info("Enabling the key rotation if not done")
enable_key_rotation()
log.info("Setting the key rotation time by editing storage cluster")
OSDKeyrotation().set_keyrotation_schedule(schedule)
schedule = f"*/{time_interval_to_rotate_key_in_minutes} * * * *"
log.info("Verifying the key rotation time set properly or not")
verify_key_rotation_time(schedule=schedule)
log.info("Verifying the new key generated by comparing it with older key")
Expand Down Expand Up @@ -116,7 +112,6 @@ def test_cluster_wide_encryption_key_rotation_system(
"After OSD resize, verifying the new key generated by comparing it with older key"
)
verify_new_key_after_rotation(tries, delays)
run_fio_obj.cleanup()

log.info("Triggering noobaa rebuild test")

Expand Down Expand Up @@ -146,3 +141,4 @@ def test_cluster_wide_encryption_key_rotation_system(
"After noobaa db backup and recovery, verifying the new key generated by comparing it with older key"
)
verify_new_key_after_rotation(tries, delays)
run_fio_obj.cleanup()

0 comments on commit c5068f5

Please sign in to comment.