Skip to content

Commit

Permalink
Merge pull request rook#4518 from travisn/is-upgrade
Browse files Browse the repository at this point in the history
Only perform upgrade checks when the image changes
  • Loading branch information
leseb authored Dec 17, 2019
2 parents f48e094 + b79c223 commit 8f00654
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions pkg/operator/ceph/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (c *cluster) checkSetOrchestrationStatus() bool {
}

// This function compare the Ceph spec image and the cluster running version
// It returns false if the image is different and true if identical
// It returns true if the image is different and false if identical
func diffImageSpecAndClusterRunningVersion(imageSpecVersion cephver.CephVersion, runningVersions client.CephDaemonsVersions) (bool, error) {
numberOfCephVersions := len(runningVersions.Overall)
if numberOfCephVersions == 0 {
Expand All @@ -403,10 +403,9 @@ func diffImageSpecAndClusterRunningVersion(imageSpecVersion cephver.CephVersion,
clusterRunningVersion := *version

// If this is the same version
// We return 'true' so that we restart using the Ceph checks
if cephver.IsIdentical(clusterRunningVersion, imageSpecVersion) {
logger.Debugf("both cluster and image spec versions are identical, doing nothing %s", imageSpecVersion.String())
return true, nil
return false, nil
}

if cephver.IsSuperior(imageSpecVersion, clusterRunningVersion) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/ceph/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestDiffImageSpecAndClusterRunningVersion(t *testing.T) {

m, err = diffImageSpecAndClusterRunningVersion(fakeImageVersion, dummyRunningVersions5)
assert.NoError(t, err)
assert.True(t, m)
assert.False(t, m)
}

func TestMinVersion(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions pkg/operator/ceph/cluster/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ func (c *ClusterController) onUpdate(oldObj, newObj interface{}) {
// Also we make sure there is actually an upgrade to perform
// It's not because the image spec changed that the ceph version did
// Someone could use the same Ceph version but with a different base OS content
cluster.isUpgrade = false
if versionChanged {
// we compare against cluster.Info.CephVersion since it received the new spec version earlier
// so don't get confused by the name of the function and its arguments
Expand All @@ -645,9 +646,9 @@ func (c *ClusterController) onUpdate(oldObj, newObj interface{}) {
return
}
}
// If Ceph is healthy let's start the upgrade!
cluster.isUpgrade = true
}
// If Ceph is healthy let's start the upgrade!
cluster.isUpgrade = true
} else {
logger.Infof("ceph daemons running versions are: %+v", runningVersions)
}
Expand Down

0 comments on commit 8f00654

Please sign in to comment.