diff --git a/controllers/instanceha/instanceha_controller.go b/controllers/instanceha/instanceha_controller.go index 306eb176..9ce979fc 100644 --- a/controllers/instanceha/instanceha_controller.go +++ b/controllers/instanceha/instanceha_controller.go @@ -540,27 +540,14 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { handler.EnqueueRequestsFromMapFunc(r.findObjectsForSrc), builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), ). - Watches( - &corev1.Secret{}, - handler.EnqueueRequestsFromMapFunc(r.findObjectsForSrc), - builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), - ). - Watches( - &corev1.Secret{}, - handler.EnqueueRequestsFromMapFunc(r.findObjectsForSrc), - builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), - ). - Watches( - &corev1.ConfigMap{}, - handler.EnqueueRequestsFromMapFunc(r.findObjectsForSrc), - builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}), - ). Complete(r) } func (r *Reconciler) findObjectsForSrc(ctx context.Context, src client.Object) []reconcile.Request { requests := []reconcile.Request{} + l := log.FromContext(context.Background()).WithName("Controllers").WithName("InstanceHa") + for _, field := range allWatchFields { crList := &instancehav1.InstanceHaList{} listOps := &client.ListOptions{ @@ -569,10 +556,13 @@ func (r *Reconciler) findObjectsForSrc(ctx context.Context, src client.Object) [ } err := r.List(ctx, crList, listOps) if err != nil { - return []reconcile.Request{} + l.Error(err, fmt.Sprintf("listing %s for field: %s - %s", crList.GroupVersionKind().Kind, field, src.GetNamespace())) + return requests } for _, item := range crList.Items { + l.Info(fmt.Sprintf("input source %s changed, reconcile: %s - %s", src.GetName(), item.GetName(), item.GetNamespace())) + requests = append(requests, reconcile.Request{ NamespacedName: types.NamespacedName{ diff --git a/controllers/memcached/memcached_controller.go b/controllers/memcached/memcached_controller.go index 39018d73..edf18af5 100644 --- a/controllers/memcached/memcached_controller.go +++ b/controllers/memcached/memcached_controller.go @@ -468,6 +468,8 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { func (r *Reconciler) findObjectsForSrc(_ context.Context, src client.Object) []reconcile.Request { requests := []reconcile.Request{} + l := log.FromContext(context.Background()).WithName("Controllers").WithName("Memcached") + for _, field := range allWatchFields { crList := &memcachedv1.MemcachedList{} listOps := &client.ListOptions{ @@ -476,10 +478,13 @@ func (r *Reconciler) findObjectsForSrc(_ context.Context, src client.Object) []r } err := r.List(context.TODO(), crList, listOps) if err != nil { - return []reconcile.Request{} + l.Error(err, fmt.Sprintf("listing %s for field: %s - %s", crList.GroupVersionKind().Kind, field, src.GetNamespace())) + return requests } for _, item := range crList.Items { + l.Info(fmt.Sprintf("input source %s changed, reconcile: %s - %s", src.GetName(), item.GetName(), item.GetNamespace())) + requests = append(requests, reconcile.Request{ NamespacedName: types.NamespacedName{ diff --git a/controllers/rabbitmq/transporturl_controller.go b/controllers/rabbitmq/transporturl_controller.go index f7ebdf9a..b95a8718 100644 --- a/controllers/rabbitmq/transporturl_controller.go +++ b/controllers/rabbitmq/transporturl_controller.go @@ -368,6 +368,8 @@ func (r *TransportURLReconciler) SetupWithManager(mgr ctrl.Manager) error { func (r *TransportURLReconciler) findObjectsForSrc(ctx context.Context, src client.Object) []reconcile.Request { requests := []reconcile.Request{} + l := log.FromContext(context.Background()).WithName("Controllers").WithName("TransportURL") + for _, field := range allWatchFields { crList := &rabbitmqv1.TransportURLList{} listOps := &client.ListOptions{ @@ -376,10 +378,13 @@ func (r *TransportURLReconciler) findObjectsForSrc(ctx context.Context, src clie } err := r.List(ctx, crList, listOps) if err != nil { - return []reconcile.Request{} + l.Error(err, fmt.Sprintf("listing %s for field: %s - %s", crList.GroupVersionKind().Kind, field, src.GetNamespace())) + return requests } for _, item := range crList.Items { + l.Info(fmt.Sprintf("input source %s changed, reconcile: %s - %s", src.GetName(), item.GetName(), item.GetNamespace())) + requests = append(requests, reconcile.Request{ NamespacedName: types.NamespacedName{ diff --git a/controllers/redis/redis_controller.go b/controllers/redis/redis_controller.go index f69e3122..dd7c5746 100644 --- a/controllers/redis/redis_controller.go +++ b/controllers/redis/redis_controller.go @@ -465,6 +465,8 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error { func (r *Reconciler) findObjectsForSrc(ctx context.Context, src client.Object) []reconcile.Request { requests := []reconcile.Request{} + l := log.FromContext(context.Background()).WithName("Controllers").WithName("Redis") + for _, field := range allWatchFields { crList := &redisv1.RedisList{} listOps := &client.ListOptions{ @@ -473,10 +475,13 @@ func (r *Reconciler) findObjectsForSrc(ctx context.Context, src client.Object) [ } err := r.List(ctx, crList, listOps) if err != nil { - return []reconcile.Request{} + l.Error(err, fmt.Sprintf("listing %s for field: %s - %s", crList.GroupVersionKind().Kind, field, src.GetNamespace())) + return requests } for _, item := range crList.Items { + l.Info(fmt.Sprintf("input source %s changed, reconcile: %s - %s", src.GetName(), item.GetName(), item.GetNamespace())) + requests = append(requests, reconcile.Request{ NamespacedName: types.NamespacedName{