Skip to content

Commit 6ffbe24

Browse files
authored
Set channel annotation for no-op equal to spec channel when spec channel is lower (#1035)
Signed-off-by: Daniel Fan <[email protected]>
1 parent 935adbb commit 6ffbe24

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

controllers/operandrequest/reconcile_operator.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,11 @@ func (r *Reconciler) reconcileSubscription(ctx context.Context, requestInstance
220220
requestInstance.SetNoSuitableRegistryCondition(registryKey.String(), opt.Name+" is in maintenance status", operatorv1alpha1.ResourceTypeOperandRegistry, corev1.ConditionTrue, &r.Mutex)
221221
requestInstance.SetMemberStatus(operand.Name, operatorv1alpha1.OperatorRunning, operatorv1alpha1.ServiceRunning, mu)
222222

223-
//set operator channel back to previous one if it is tombstone service
224-
sub.Annotations[requestInstance.Namespace+"."+requestInstance.Name+"."+operand.Name+"/request"] = sub.Spec.Channel
223+
// check if sub.Spec.Channel and opt.Channel are valid semantic version
224+
// set annotation channel back to previous one if sub.Spec.Channel is lower than opt.Channel
225+
if semver.IsValid(sub.Spec.Channel) && semver.IsValid(opt.Channel) && semver.Compare(sub.Spec.Channel, opt.Channel) < 0 {
226+
sub.Annotations[requestInstance.Namespace+"."+requestInstance.Name+"."+operand.Name+"/request"] = sub.Spec.Channel
227+
}
225228
} else {
226229
requestInstance.SetNotFoundOperatorFromRegistryCondition(operand.Name, operatorv1alpha1.ResourceTypeSub, corev1.ConditionFalse, mu)
227230

0 commit comments

Comments
 (0)