Skip to content

Commit 7ea5b69

Browse files
committed
(feat) requeue the csv when subscription changes
When a subscription changes, if it has an installed CSV then requeue it so that any changes in pod configuration can take effect immediately.
1 parent aa6528f commit 7ea5b69

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pkg/controller/operators/olm/operator.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,12 +453,21 @@ func (a *Operator) now() metav1.Time {
453453
}
454454

455455
func (a *Operator) syncSubscription(obj interface{}) error {
456-
_, ok := obj.(*v1alpha1.Subscription)
456+
sub, ok := obj.(*v1alpha1.Subscription)
457457
if !ok {
458458
a.logger.Debugf("wrong type: %#v\n", obj)
459459
return fmt.Errorf("casting Subscription failed")
460460
}
461461

462+
installedCSV := sub.Status.InstalledCSV
463+
if installedCSV != "" {
464+
a.logger.WithField("csv", installedCSV).Debug("subscription has changed, requeuing installed csv")
465+
if err := a.csvQueueSet.Requeue(sub.GetNamespace(), installedCSV); err != nil {
466+
a.logger.WithField("csv", installedCSV).Debug("failed to requeue installed csv")
467+
return err
468+
}
469+
}
470+
462471
return nil
463472
}
464473

0 commit comments

Comments
 (0)