ceph: Add nil check for ceph version

as CephVersion is pointer added a nil check
for CephVersion in status to avoid panic.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna committed 2020-01-29 19:34:30 +05:30
1 parent 8043afb165
commit 34e1585f54
1 file changed
+1 -1
+1 -1
View File
@@ -208,7 +208,7 @@ func getImageVersion(cephCluster cephv1.CephCluster) (*version.CephVersion, erro
for i := 0; i < getVersionMaxRetries; i++ {
// If the Ceph cluster has not yet recorded the image and version for the current image in its spec, then the Crash
// controller should wait for the version to be detected.
if cephCluster.Spec.CephVersion.Image == cephCluster.Status.CephVersion.Image {
if cephCluster.Status.CephVersion != nil && cephCluster.Spec.CephVersion.Image == cephCluster.Status.CephVersion.Image {
logger.Debugf("ceph version found %q", cephCluster.Status.CephVersion.Version)
return spec.ExtractCephVersionFromLabel(cephCluster.Status.CephVersion.Version)
}