diff --git a/controllers/logging/loggingroute_controller.go b/controllers/logging/loggingroute_controller.go index d12f81ba5..f7f30f917 100644 --- a/controllers/logging/loggingroute_controller.go +++ b/controllers/logging/loggingroute_controller.go @@ -22,10 +22,8 @@ import ( "github.com/go-logr/logr" apitypes "k8s.io/apimachinery/pkg/types" ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/handler" - "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" "github.com/kube-logging/logging-operator/pkg/resources/fluentbit" @@ -116,6 +114,6 @@ func SetupLoggingRouteWithManager(mgr ctrl.Manager, logger logr.Logger) error { return ctrl.NewControllerManagedBy(mgr). For(&loggingv1beta1.LoggingRoute{}). - Watches(&loggingv1beta1.Logging{}, loggingRequestMapper, builder.WithPredicates(predicate.GenerationChangedPredicate{})). + Watches(&loggingv1beta1.Logging{}, loggingRequestMapper). Complete(NewLoggingRouteReconciler(mgr.GetClient(), logger)) } diff --git a/pkg/resources/fluentbit/tenants.go b/pkg/resources/fluentbit/tenants.go index a06c2027f..1e5d263b9 100644 --- a/pkg/resources/fluentbit/tenants.go +++ b/pkg/resources/fluentbit/tenants.go @@ -21,7 +21,6 @@ import ( "strings" "emperror.dev/errors" - "golang.org/x/exp/slices" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" @@ -71,19 +70,9 @@ func FindTenants(ctx context.Context, target metav1.LabelSelector, reader client } } - sort.Slice(tenants, func(i, j int) bool { + sort.SliceStable(tenants, func(i, j int) bool { return tenants[i].Name < tenants[j].Name }) - // Make sure our tenant list is stable - slices.SortStableFunc(tenants, func(a, b Tenant) int { - if a.Name < b.Name { - return -1 - } - if a.Name == b.Name { - return 0 - } - return 1 - }) return tenants, nil }