diff --git a/controllers/dbaasplatform_controller.go b/controllers/dbaasplatform_controller.go index ba49fc61..126fca26 100644 --- a/controllers/dbaasplatform_controller.go +++ b/controllers/dbaasplatform_controller.go @@ -434,8 +434,11 @@ func (r *DBaaSPlatformReconciler) fixConversionWebhooks(ctx context.Context) err return nil } +const ackRDSVersion = "1.0.0" + // Temporary solution to the rds-controller upgrade issue, will revert in the next release func (r *DBaaSPlatformReconciler) prepareRDSController(ctx context.Context, cli k8sclient.Client) error { + csvName := fmt.Sprintf("ack-rds-controller.v%s", ackRDSVersion) subscriptionList := &v1alpha1.SubscriptionList{} if err := cli.List(ctx, subscriptionList, k8sclient.InNamespace(r.InstallNamespace)); err != nil { return err @@ -443,6 +446,10 @@ func (r *DBaaSPlatformReconciler) prepareRDSController(ctx context.Context, cli for i := range subscriptionList.Items { subscription := subscriptionList.Items[i] if subscription.Spec != nil && subscription.Spec.Package == "ack-rds-controller" { + if subscription.Status.CurrentCSV == csvName || + subscription.Status.InstalledCSV == csvName { + continue + } if err := cli.Delete(ctx, &subscription); err != nil { return err } @@ -465,6 +472,9 @@ func (r *DBaaSPlatformReconciler) prepareRDSController(ctx context.Context, cli } } if instanceCRD && clusterCRD { + if csv.Spec.Version.String() == ackRDSVersion { + continue + } if err := cli.Delete(ctx, &csv); err != nil { return err } diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 98b6e7bb..c867814c 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -193,7 +193,7 @@ var _ = BeforeSuite(func() { }).SetupWithManager(k8sManager) Expect(err).ToNot(HaveOccurred()) - mockRDSController(k8sManager) + mockACKRDSController(k8sManager) createCSV(k8sManager) err = (&DBaaSPlatformReconciler{ @@ -202,7 +202,7 @@ var _ = BeforeSuite(func() { }).SetupWithManager(k8sManager) Expect(err).ToNot(HaveOccurred()) - checkRDSController(k8sManager) + checkACKRDSController(k8sManager) go func() { defer GinkgoRecover() @@ -251,7 +251,7 @@ func createCSV(k8sManager manager.Manager) { Expect(err).ToNot(HaveOccurred()) } -func mockRDSController(k8sManager manager.Manager) { +func mockACKRDSController(k8sManager manager.Manager) { serverClient, err := client.New( k8sManager.GetConfig(), client.Options{ @@ -339,7 +339,7 @@ func mockRDSController(k8sManager manager.Manager) { Expect(err).ToNot(HaveOccurred()) } -func checkRDSController(k8sManager manager.Manager) { +func checkACKRDSController(k8sManager manager.Manager) { serverClient, err := client.New( k8sManager.GetConfig(), client.Options{