Skip to content

Commit 9ef531e

Browse files
author
Peng Zhou
committed
uncomment the logic in predicate
1 parent 35b6262 commit 9ef531e

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

internal/controller/marklogiccluster_controller.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ func markLogicClusterCreateUpdateDeletePredicate() predicate.Predicate {
9494
case *marklogicv1.MarklogicCluster:
9595
oldAnnotations := e.ObjectOld.GetAnnotations()
9696
newAnnotations := e.ObjectNew.GetAnnotations()
97-
// delete(newAnnotations, "banzaicloud.com/last-applied")
98-
// delete(oldAnnotations, "banzaicloud.com/last-applied")
99-
// delete(newAnnotations, "kubectl.kubernetes.io/last-applied-configuration")
100-
// delete(oldAnnotations, "kubectl.kubernetes.io/last-applied-configuration")
97+
delete(newAnnotations, "banzaicloud.com/last-applied")
98+
delete(oldAnnotations, "banzaicloud.com/last-applied")
99+
delete(newAnnotations, "kubectl.kubernetes.io/last-applied-configuration")
100+
delete(oldAnnotations, "kubectl.kubernetes.io/last-applied-configuration")
101101
if !reflect.DeepEqual(oldAnnotations, newAnnotations) {
102102
return true // Reconcile if annotations have changed
103103
}

internal/controller/marklogicgroup_controller.go

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)