core: finalize CephCluster CephX status handling
Cleanup up overall usage of CephX statuses in CephCluster. Convert all CephX statuses to non-pointer types. There is no specific need for pointer types, and keeping these as non-pointers means there is not a risk of nil pointer exceptions in all the various Rook controllers for upgraded clusters. Move initialization of CephCluster CephX status items to `preMonStartupActions()`. This helps resolve 2 issues: 1. 'Uninitialized' state was being set for external CephClusters where CephX statuses are not relevant. 2. 'Uninitialized' state was being set for upgraded clusters whose key status cannot be determined. Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
This commit is contained in:
18 files changed
+301
-135
No files matched your search
@@ -249,7 +249,7 @@ func shouldRotateMirrorPeerKeys(c *clusterd.Context, clusterInfo *cephclient.Clu
|
||||
desiredCephVersion := clusterInfo.CephVersion
|
||||
runningCephVersion := clusterInfo.CephVersion
|
||||
|
||||
shouldRotateKeys, err := keyring.ShouldRotateCephxKeys(cephObj.Spec.Security.CephX.RBDMirrorPeer, runningCephVersion, desiredCephVersion, *cephObj.Status.Cephx.RBDMirrorPeer)
|
||||
shouldRotateKeys, err := keyring.ShouldRotateCephxKeys(cephObj.Spec.Security.CephX.RBDMirrorPeer, runningCephVersion, desiredCephVersion, cephObj.Status.Cephx.RBDMirrorPeer)
|
||||
if err != nil {
|
||||
return false, errors.Wrap(err, "failed to check if mirror peer keys should be rotated or not")
|
||||
}
|
||||
@@ -264,8 +264,8 @@ func updateCephClusterCephxRbdMirrorStatus(c *clusterd.Context, clusterInfo *cep
|
||||
if err := c.Client.Get(clusterInfo.Context, clusterInfo.NamespacedName(), cluster); err != nil {
|
||||
return errors.Wrapf(err, "failed to get cluster %v to update the conditions.", clusterInfo.NamespacedName())
|
||||
}
|
||||
updatedStatus := keyring.UpdatedCephxStatus(didRotate, cluster.Spec.Security.CephX.RBDMirrorPeer, clusterInfo.CephVersion, *cluster.Status.Cephx.RBDMirrorPeer)
|
||||
cluster.Status.Cephx.RBDMirrorPeer = &updatedStatus
|
||||
updatedStatus := keyring.UpdatedCephxStatus(didRotate, cluster.Spec.Security.CephX.RBDMirrorPeer, clusterInfo.CephVersion, cluster.Status.Cephx.RBDMirrorPeer)
|
||||
cluster.Status.Cephx.RBDMirrorPeer = updatedStatus
|
||||
logger.Debugf("updating rbd-mirror cephx status to %+v", cluster.Status.Cephx.RBDMirrorPeer)
|
||||
if err := reporting.UpdateStatus(c.Client, cluster); err != nil {
|
||||
return errors.Wrap(err, "failed to update cluster cephx status for rbd-mirror")
|
||||
|
||||
Reference in new issue
Block a user