@@ -104,27 +104,26 @@ func markLogicGroupCreateUpdateDeletePredicate() predicate.Predicate {
104104 UpdateFunc : func (e event.UpdateEvent ) bool {
105105 switch e .ObjectNew .(type ) {
106106 case * marklogicv1.MarklogicGroup :
107- return true // Reconcile on update of MarklogicGroup
108- // oldAnnotations := e.ObjectOld.GetAnnotations()
109- // newAnnotations := e.ObjectNew.GetAnnotations()
110- // delete(newAnnotations, "banzaicloud.com/last-applied")
111- // delete(oldAnnotations, "banzaicloud.com/last-applied")
112- // delete(newAnnotations, "kubectl.kubernetes.io/last-applied-configuration")
113- // delete(oldAnnotations, "kubectl.kubernetes.io/last-applied-configuration")
114- // if !reflect.DeepEqual(oldAnnotations, newAnnotations) {
115- // return true // Reconcile if annotations have changed
116- // }
117- // oldLables := e.ObjectOld.GetLabels()
118- // newLabels := e.ObjectNew.GetLabels()
119- // if !reflect.DeepEqual(oldLables, newLabels) {
120- // return true // Reconcile if labels have changed
121- // }
122- // oldObj := e.ObjectOld.(*marklogicv1.MarklogicGroup)
123- // newObj := e.ObjectNew.(*marklogicv1.MarklogicGroup)
124- // if !reflect.DeepEqual(oldObj.Spec, newObj.Spec) {
125- // return true // Reconcile if the spec has changed
126- // }
127- // return false
107+ oldAnnotations := e .ObjectOld .GetAnnotations ()
108+ newAnnotations := e .ObjectNew .GetAnnotations ()
109+ delete (newAnnotations , "banzaicloud.com/last-applied" )
110+ delete (oldAnnotations , "banzaicloud.com/last-applied" )
111+ delete (newAnnotations , "kubectl.kubernetes.io/last-applied-configuration" )
112+ delete (oldAnnotations , "kubectl.kubernetes.io/last-applied-configuration" )
113+ if ! reflect .DeepEqual (oldAnnotations , newAnnotations ) {
114+ return true // Reconcile if annotations have changed
115+ }
116+ oldLables := e .ObjectOld .GetLabels ()
117+ newLabels := e .ObjectNew .GetLabels ()
118+ if ! reflect .DeepEqual (oldLables , newLabels ) {
119+ return true // Reconcile if labels have changed
120+ }
121+ oldObj := e .ObjectOld .(* marklogicv1.MarklogicGroup )
122+ newObj := e .ObjectNew .(* marklogicv1.MarklogicGroup )
123+ if ! reflect .DeepEqual (oldObj .Spec , newObj .Spec ) {
124+ return true // Reconcile if the spec has changed
125+ }
126+ return false
128127 case * appsv1.StatefulSet :
129128 return true // Reconcile on update of StatefulSet
130129 case * corev1.Service :
0 commit comments