Skip to content

Commit

Permalink
add support for enabling clusterwide encryption as day-2 operation
Browse files Browse the repository at this point in the history
Signed-off-by: Santosh Pillai <[email protected]>
  • Loading branch information
sp98 committed Jan 16, 2025
1 parent 9ae10c8 commit e6e8c14
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions controllers/storagecluster/cephcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ func (obj *ocsCephCluster) ensureCreated(r *StorageClusterReconciler, sc *ocsv1.
// Update OSD store to `bluestore`
cephCluster.Spec.Storage.Store = updateOSDStore(found.Spec.Storage.Store)

// confirm OSD migration if encryption is enbled as day-2 operation

Check failure on line 274 in controllers/storagecluster/cephcluster.go

View workflow job for this annotation

GitHub Actions / verify code spellings

enbled ==> enabled
if isEncrptionSettingUpdated(cephCluster.Spec.Storage.StorageClassDeviceSets, found.Spec.Storage.StorageClassDeviceSets) {
cephCluster.Spec.Storage.Migration.Confirmation = "yes-really-migrate-osds"
}

// Add it to the list of RelatedObjects if found
objectRef, err := reference.GetReference(r.Scheme, found)
if err != nil {
Expand Down Expand Up @@ -1399,3 +1404,17 @@ func determineDefaultCephDeviceClass(foundDeviceClasses []rookCephv1.DeviceClass
// if no device classes are found in status return empty string
return ""
}

// isEncrptionSettingUpdated checks whether ecryption was enabled or disabled for the storageClassDeviceSet.
func isEncrptionSettingUpdated(newDeviceSet, existingDeviceSet []rookCephv1.StorageClassDeviceSet) bool {
if len(newDeviceSet) != len(existingDeviceSet) {
return false
}

for i := range newDeviceSet {
if newDeviceSet[i].Encrypted != existingDeviceSet[i].Encrypted {
return true
}
}
return false
}

0 comments on commit e6e8c14

Please sign in to comment.