Skip to content

Commit

Permalink
Set channel annotation for no-op equal to spec channel when spec chan…
Browse files Browse the repository at this point in the history
…nel is lower (#1035)

Signed-off-by: Daniel Fan <fanyuchensx@gmail.com>
  • Loading branch information
Daniel-Fan authored Apr 15, 2024
1 parent 935adbb commit 6ffbe24
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions controllers/operandrequest/reconcile_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,11 @@ func (r *Reconciler) reconcileSubscription(ctx context.Context, requestInstance
requestInstance.SetNoSuitableRegistryCondition(registryKey.String(), opt.Name+" is in maintenance status", operatorv1alpha1.ResourceTypeOperandRegistry, corev1.ConditionTrue, &r.Mutex)
requestInstance.SetMemberStatus(operand.Name, operatorv1alpha1.OperatorRunning, operatorv1alpha1.ServiceRunning, mu)

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

Expand Down

0 comments on commit 6ffbe24

Please sign in to comment.