diff --git a/controllers/drupalsite_controller.go b/controllers/drupalsite_controller.go index 52cf4c15e7b70464dcc8eb955cb532c0c9784cd1..11e02690637162baa36c19101c52ad8269449552 100644 --- a/controllers/drupalsite_controller.go +++ b/controllers/drupalsite_controller.go @@ -339,8 +339,8 @@ func (r *DrupalSiteReconciler) Reconcile(ctx context.Context, req ctrl.Request) setErrorCondition(drupalSite, reconcileErr) return r.updateCRStatusOrFailReconcile(ctx, log, drupalSite) case updateNeeded: - log.Info("Updating DrupalProjectConfig " + drupalProjectConfig.Namespace) - r.updateDrupalProjectConfigCRorFailReconcile(ctx, log, drupalProjectConfig) + log.Info("Updating DrupalProjectConfig ") + r.updateDrupalProjectConfigCR(ctx, log, drupalProjectConfig) } // Check if current instance is the Primary Drupalsite updateNeeded, reconcileErr = r.checkIfPrimaryDrupalsite(ctx, drupalSite, drupalProjectConfig) diff --git a/controllers/drupalsite_controller_test.go b/controllers/drupalsite_controller_test.go index 723ea3f443529e35e4b34cd3fe756999b96db1a3..c73af3a591ed38d832919e2c81f696a1fc8cac98 100644 --- a/controllers/drupalsite_controller_test.go +++ b/controllers/drupalsite_controller_test.go @@ -1918,7 +1918,21 @@ var _ = Describe("DrupalSite controller", func() { }) }) }) - + Describe("TODO Using DrupalProjectConfig", func() { + Context("", func() { + It("", func() { + // Tests that should be done + // Create a new project without any DrupalProjectConfig, operator logs Warning: Project $PROJECT does not contain any DrupalProjectConfig! + // Createda DrupalProjectConfig with one website and saw spec getting automatically filled, $PROJECT only 1 drupalsite\"$DRUPALSITE\", which is considered the primary production site + // Creation of a second website does not affect DrupalProjectConfig + // Creation of DrupalProjectConfig with 2 DrupalSites in place will not automatically fill spec.primarySiteName + // Deletion of 2 instances to 1, and spec.primarySiteName=="", will auto-fill + // If spec.primarySiteName!="", it is never auto-filled, not even with just one instance being created + // By default DrupalSite.status.isPrimary is false + // Editing DrupalProjectConfig will reflect changes on DrupalSite.status.isPrimary + }) + }) + }) Describe("Deleting the drupalsite object", func() { Context("With critical QoS", func() { It("Should be deleted successfully", func() { diff --git a/controllers/reconciler_utils.go b/controllers/reconciler_utils.go index 0cf218345689f1ff5d6db116ec14918f1412ae11..9e5030c3c57b34748387c2cba0fdba322b62de4d 100644 --- a/controllers/reconciler_utils.go +++ b/controllers/reconciler_utils.go @@ -121,7 +121,7 @@ func setDBUpdatesPending(drp *webservicesv1a1.DrupalSite) (update bool) { } // updateCRorFailReconcile tries to update the Custom Resource and logs any error -func (r *DrupalSiteReconciler) updateDrupalProjectConfigCRorFailReconcile(ctx context.Context, log logr.Logger, dpc *webservicesv1a1.DrupalProjectConfig) { +func (r *DrupalSiteReconciler) updateDrupalProjectConfigCR(ctx context.Context, log logr.Logger, dpc *webservicesv1a1.DrupalProjectConfig) { if err := r.Update(ctx, dpc); err != nil { if k8sapierrors.IsConflict(err) { log.V(4).Info("Object changed while reconciling. Requeuing.")