Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions pkg/controller/clusterversion/clusterversion_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,11 @@ func (r *ReconcileClusterVersion) updateClusterVersionMetadata(cd *hivev1.Cluste
}
}
changed = changed || upgradeableCondition != cd.Annotations[constants.MinorVersionUpgradeUnavailable]
if upgradeableCondition == "" {
delete(cd.Annotations, constants.MinorVersionUpgradeUnavailable)
} else {
if cd.Annotations == nil {
cd.Annotations = map[string]string{}
}
cd.Annotations[constants.MinorVersionUpgradeUnavailable] = upgradeableCondition

if cd.Annotations == nil {
cd.Annotations = map[string]string{}
}
cd.Annotations[constants.MinorVersionUpgradeUnavailable] = upgradeableCondition

if !changed {
cdLog.Debug("cluster version metadata has not changed, nothing to update")
Expand Down
12 changes: 6 additions & 6 deletions pkg/controller/clusterversion/clusterversion_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestClusterVersionReconcile(t *testing.T) {
Status: configv1.ConditionTrue,
}),
validate: func(t *testing.T, cd *hivev1.ClusterDeployment) {
assert.Equal(t, "", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected version major-minor-patch label")
assert.Equal(t, "", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected value for annotation hive.openshift.io/minor-version-upgrade-unavailable")
},
},
{
Expand All @@ -103,7 +103,7 @@ func TestClusterVersionReconcile(t *testing.T) {
Status: configv1.ConditionFalse,
}),
validate: func(t *testing.T, cd *hivev1.ClusterDeployment) {
assert.Equal(t, "Upgradeable: False", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected version major-minor-patch label")
assert.Equal(t, "Upgradeable: False", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected value for annotation hive.openshift.io/minor-version-upgrade-unavailable")
},
},
{
Expand All @@ -118,7 +118,7 @@ func TestClusterVersionReconcile(t *testing.T) {
Message: "Can't do the upgrade",
}),
validate: func(t *testing.T, cd *hivev1.ClusterDeployment) {
assert.Equal(t, "Can't do the upgrade", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected version major-minor-patch label")
assert.Equal(t, "Can't do the upgrade", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected value for annotation hive.openshift.io/minor-version-upgrade-unavailable")
},
},
{
Expand All @@ -132,7 +132,7 @@ func TestClusterVersionReconcile(t *testing.T) {
Status: configv1.ConditionUnknown,
}),
validate: func(t *testing.T, cd *hivev1.ClusterDeployment) {
assert.Equal(t, "Upgradeable: Unknown", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected version major-minor-patch label")
assert.Equal(t, "Upgradeable: Unknown", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected value for annotation hive.openshift.io/minor-version-upgrade-unavailable")
},
},
{
Expand All @@ -147,7 +147,7 @@ func TestClusterVersionReconcile(t *testing.T) {
Message: "Can't read status",
}),
validate: func(t *testing.T, cd *hivev1.ClusterDeployment) {
assert.Equal(t, "Can't read status", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected version major-minor-patch label")
assert.Equal(t, "Can't read status", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected value for annotation hive.openshift.io/minor-version-upgrade-unavailable")
},
},
{
Expand All @@ -166,7 +166,7 @@ func TestClusterVersionReconcile(t *testing.T) {
Message: "It can't upgrade",
}),
validate: func(t *testing.T, cd *hivev1.ClusterDeployment) {
assert.Equal(t, "It can't upgrade", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected version major-minor-patch label")
assert.Equal(t, "It can't upgrade", cd.Annotations[constants.MinorVersionUpgradeUnavailable], "unexpected value for annotation hive.openshift.io/minor-version-upgrade-unavailable")
},
},
}
Expand Down