@@ -266,6 +266,11 @@ func (c *OperatorConfigMapReconciler) Reconcile(ctx context.Context, req ctrl.Re
266266 return ctrl.Result {}, err
267267 }
268268
269+ if err := c .reconcileCephCSIOperatorSubscription (); err != nil {
270+ c .log .Error (err , "unable to reconcile Ceph CSI Operator subscription" )
271+ return ctrl.Result {}, err
272+ }
273+
269274 if err := c .ensureConsolePlugin (); err != nil {
270275 c .log .Error (err , "unable to deploy client console" )
271276 return ctrl.Result {}, err
@@ -654,6 +659,23 @@ func (c *OperatorConfigMapReconciler) reconcileCSIAddonsOperatorSubscription() e
654659 return nil
655660}
656661
662+ func (c * OperatorConfigMapReconciler ) reconcileCephCSIOperatorSubscription () error {
663+ cephCsiOperatorSubscription , err := c .getSubscriptionByPackageName ("cephcsi-operator" )
664+ if kerrors .IsNotFound (err ) {
665+ cephCsiOperatorSubscription , err = c .getSubscriptionByPackageName ("ceph-csi-operator" )
666+ }
667+ if err != nil {
668+ return err
669+ }
670+ if c .subscriptionChannel != "" && c .subscriptionChannel != cephCsiOperatorSubscription .Spec .Channel {
671+ cephCsiOperatorSubscription .Spec .Channel = c .subscriptionChannel
672+ if err := c .update (cephCsiOperatorSubscription ); err != nil {
673+ return fmt .Errorf ("failed to update subscription channel of 'cephcsi-operator' to %v: %v" , c .subscriptionChannel , err )
674+ }
675+ }
676+ return nil
677+ }
678+
657679func (c * OperatorConfigMapReconciler ) reconcileWebhookService () error {
658680 svc := & corev1.Service {}
659681 svc .Name = templates .WebhookServiceName
0 commit comments