@@ -208,38 +208,12 @@ func (in *CoherenceReconciler) Reconcile(ctx context.Context, request ctrl.Reque
208208 }
209209
210210 hash := deployment .GetLabels ()[coh .LabelCoherenceHash ]
211+ storeHash , _ := storage .GetHash ()
211212 var desiredResources coh.Resources
212213
213- storeHash , found := storage .GetHash ()
214- if ! found || storeHash != hash || deployment .Status .Phase != coh .ConditionTypeReady {
215- // Storage state was saved with no hash or a different hash so is not in the desired state
216- // or the Coherence resource is not in the Ready state
217- // Create the desired resources the deployment
218- if desiredResources , err = deployment .CreateKubernetesResources (); err != nil {
219- return in .HandleErrAndRequeue (ctx , err , nil , fmt .Sprintf (createResourcesFailedMessage , request .Name , request .Namespace , err ), in .Log )
220- }
221-
222- if found {
223- // The "storeHash" is not "", so it must have been processed by the Operator (could have been a previous version).
224- // There was a bug prior to 3.4.2 where the hash was calculated at the wrong point in the defaulting web-hook,
225- // and the has used only a portion of the spec, so the "currentHash" may be wrong, and hence differ from the
226- // recalculated "hash".
227- if deployment .IsBeforeVersion ("3.4.2" ) {
228- // the AnnotationOperatorVersion annotation was added in the 3.2.8 web-hook, so if it is missing
229- // the Coherence resource was added or updated prior to 3.2.8, or the version is present but is
230- // prior to 3.4.2. In this case we just ignore the difference in hash.
231- // There is an edge case where the Coherence resource could have legitimately been updated whilst
232- // the Operator and web-hooks were uninstalled. In that case we would ignore the update until another
233- // update is made. The simplest way for the customer to work around this is to add the
234- // AnnotationOperatorVersion annotation with some value, which will then be overwritten by the web-hook
235- // and the Coherence resource will be correctly processes.
236- desiredResources = storage .GetLatest ()
237- log .Info ("Ignoring hash difference for pre-3.4.2 resource" , "hash" , hash , "store" , storeHash )
238- }
239- }
240- } else {
241- // storage state was saved with the current hash so is already in the desired state
242- desiredResources = storage .GetLatest ()
214+ desiredResources , err = checkCoherenceHash (deployment , storage , log )
215+ if err != nil {
216+ return in .HandleErrAndRequeue (ctx , err , nil , fmt .Sprintf (createResourcesFailedMessage , request .Name , request .Namespace , err ), in .Log )
243217 }
244218
245219 // create the result
@@ -284,9 +258,6 @@ func (in *CoherenceReconciler) Reconcile(ctx context.Context, request ctrl.Reque
284258 }
285259 return reconcile.Result {}, fmt .Errorf ("one or more secondary resource reconcilers failed to reconcile" )
286260 }
287- //} else {
288- // log.Info("Skipping updates for Coherence resource, annotation " + coh.AnnotationOperatorIgnore + " is set to true")
289- //}
290261
291262 // if replica count is zero update the status to Stopped
292263 if deployment .GetReplicas () == 0 {
0 commit comments