Skip to content

Commit 8c4c67b

Browse files
authored
Merge pull request #11188 from Karthik-K-N/predicate-log
⚠️ Fix object logging in ResourceHasFilterLabel, ResourceNotPaused & ResourceNotPausedAndHasFilterLabel predicates
2 parents 7c62eb2 + f8e6c0b commit 8c4c67b

File tree

24 files changed

+73
-55
lines changed

24 files changed

+73
-55
lines changed

bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (r *KubeadmConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl
117117
Watches(
118118
&clusterv1.Machine{},
119119
handler.EnqueueRequestsFromMapFunc(r.MachineToBootstrapMapFunc),
120-
).WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue))
120+
).WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue))
121121

122122
if feature.Gates.Enabled(feature.MachinePool) {
123123
b = b.Watches(
@@ -132,7 +132,7 @@ func (r *KubeadmConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl
132132
builder.WithPredicates(
133133
predicates.All(predicateLog,
134134
predicates.ClusterUnpausedAndInfrastructureReady(predicateLog),
135-
predicates.ResourceHasFilterLabel(predicateLog, r.WatchFilterValue),
135+
predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue),
136136
),
137137
),
138138
)

controllers/external/tracker.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222

2323
"github.com/go-logr/logr"
2424
"github.com/pkg/errors"
25+
"k8s.io/apimachinery/pkg/runtime"
2526
"sigs.k8s.io/controller-runtime/pkg/cache"
2627
"sigs.k8s.io/controller-runtime/pkg/client"
2728
"sigs.k8s.io/controller-runtime/pkg/controller"
@@ -38,6 +39,7 @@ type ObjectTracker struct {
3839

3940
Controller controller.Controller
4041
Cache cache.Cache
42+
Scheme *runtime.Scheme
4143
}
4244

4345
// Watch uses the controller to issue a Watch only if the object hasn't been seen before.
@@ -47,6 +49,10 @@ func (o *ObjectTracker) Watch(log logr.Logger, obj client.Object, handler handle
4749
return nil
4850
}
4951

52+
if o.Cache == nil || o.Scheme == nil {
53+
return errors.New("both scheme and cache must be set for object tracker")
54+
}
55+
5056
gvk := obj.GetObjectKind().GroupVersionKind()
5157
key := gvk.GroupKind().String()
5258
if _, loaded := o.m.LoadOrStore(key, struct{}{}); loaded {
@@ -58,7 +64,7 @@ func (o *ObjectTracker) Watch(log logr.Logger, obj client.Object, handler handle
5864
o.Cache,
5965
obj.DeepCopyObject().(client.Object),
6066
handler,
61-
append(p, predicates.ResourceNotPaused(log))...,
67+
append(p, predicates.ResourceNotPaused(o.Scheme, log))...,
6268
))
6369
if err != nil {
6470
o.m.Delete(key)

controllers/external/tracker_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
. "github.com/onsi/gomega"
2424
"github.com/pkg/errors"
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26+
"k8s.io/apimachinery/pkg/runtime"
27+
"sigs.k8s.io/controller-runtime/pkg/cache/informertest"
2628
"sigs.k8s.io/controller-runtime/pkg/controller"
2729
"sigs.k8s.io/controller-runtime/pkg/log"
2830
"sigs.k8s.io/controller-runtime/pkg/source"
@@ -64,7 +66,7 @@ func (c *watchCountController) Watch(_ source.Source) error {
6466
func TestRetryWatch(t *testing.T) {
6567
g := NewWithT(t)
6668
ctrl := newWatchCountController(true)
67-
tracker := ObjectTracker{Controller: ctrl}
69+
tracker := ObjectTracker{Controller: ctrl, Scheme: runtime.NewScheme(), Cache: &informertest.FakeInformers{}}
6870

6971
err := tracker.Watch(logger, &clusterv1.Cluster{}, nil)
7072
g.Expect(err).To(HaveOccurred())
@@ -78,7 +80,7 @@ func TestRetryWatch(t *testing.T) {
7880
func TestWatchMultipleTimes(t *testing.T) {
7981
g := NewWithT(t)
8082
ctrl := &watchCountController{}
81-
tracker := ObjectTracker{Controller: ctrl}
83+
tracker := ObjectTracker{Controller: ctrl, Scheme: runtime.NewScheme(), Cache: &informertest.FakeInformers{}}
8284

8385
obj := &clusterv1.Cluster{
8486
TypeMeta: metav1.TypeMeta{

controllers/remote/cluster_cache_reconciler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (r *ClusterCacheReconciler) SetupWithManager(ctx context.Context, mgr ctrl.
4646
Named("remote/clustercache").
4747
For(&clusterv1.Cluster{}).
4848
WithOptions(options).
49-
WithEventFilter(predicates.ResourceHasFilterLabel(predicateLog, r.WatchFilterValue)).
49+
WithEventFilter(predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
5050
Complete(r)
5151

5252
if err != nil {

controlplane/kubeadm/internal/controllers/controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ func (r *KubeadmControlPlaneReconciler) SetupWithManager(ctx context.Context, mg
9898
For(&controlplanev1.KubeadmControlPlane{}).
9999
Owns(&clusterv1.Machine{}).
100100
WithOptions(options).
101-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
101+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
102102
Watches(
103103
&clusterv1.Cluster{},
104104
handler.EnqueueRequestsFromMapFunc(r.ClusterToKubeadmControlPlane),
105105
builder.WithPredicates(
106106
predicates.All(predicateLog,
107-
predicates.ResourceHasFilterLabel(predicateLog, r.WatchFilterValue),
107+
predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue),
108108
predicates.ClusterUnpausedAndInfrastructureReady(predicateLog),
109109
),
110110
),

exp/addons/internal/controllers/clusterresourceset_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (r *ClusterResourceSetReconciler) SetupWithManager(ctx context.Context, mgr
9898
resourcepredicates.TypedResourceCreateOrUpdate[*metav1.PartialObjectMetadata](predicateLog),
9999
)).
100100
WithOptions(options).
101-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
101+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
102102
Complete(r)
103103
if err != nil {
104104
return errors.Wrap(err, "failed setting up with a controller manager")

exp/addons/internal/controllers/clusterresourcesetbinding_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (r *ClusterResourceSetBindingReconciler) SetupWithManager(ctx context.Conte
5656
handler.EnqueueRequestsFromMapFunc(r.clusterToClusterResourceSetBinding),
5757
).
5858
WithOptions(options).
59-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
59+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
6060
Complete(r)
6161
if err != nil {
6262
return errors.Wrap(err, "failed setting up with a controller manager")

exp/internal/controllers/machinepool_controller.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ func (r *MachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctrl.M
108108
c, err := ctrl.NewControllerManagedBy(mgr).
109109
For(&expv1.MachinePool{}).
110110
WithOptions(options).
111-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
111+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
112112
Watches(
113113
&clusterv1.Cluster{},
114114
handler.EnqueueRequestsFromMapFunc(clusterToMachinePools),
115115
// TODO: should this wait for Cluster.Status.InfrastructureReady similar to Infra Machine resources?
116116
builder.WithPredicates(
117117
predicates.All(predicateLog,
118118
predicates.ClusterUnpaused(predicateLog),
119-
predicates.ResourceHasFilterLabel(predicateLog, r.WatchFilterValue),
119+
predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue),
120120
),
121121
),
122122
).
@@ -130,6 +130,7 @@ func (r *MachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctrl.M
130130
r.externalTracker = external.ObjectTracker{
131131
Controller: c,
132132
Cache: mgr.GetCache(),
133+
Scheme: mgr.GetScheme(),
133134
}
134135
r.ssaCache = ssa.NewCache()
135136

exp/runtime/internal/controllers/extensionconfig_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
7979
),
8080
)).
8181
WithOptions(options).
82-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
82+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
8383
Complete(r)
8484
if err != nil {
8585
return errors.Wrap(err, "failed setting up with a controller manager")

internal/controllers/cluster/cluster_controller.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
8888
handler.EnqueueRequestsFromMapFunc(r.controlPlaneMachineToCluster),
8989
).
9090
WithOptions(options).
91-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
91+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
9292
Build(r)
9393

9494
if err != nil {
@@ -99,6 +99,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
9999
r.externalTracker = external.ObjectTracker{
100100
Controller: c,
101101
Cache: mgr.GetCache(),
102+
Scheme: mgr.GetScheme(),
102103
}
103104
return nil
104105
}

internal/controllers/clusterclass/clusterclass_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
7979
&runtimev1.ExtensionConfig{},
8080
handler.EnqueueRequestsFromMapFunc(r.extensionConfigToClusterClass),
8181
).
82-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
82+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
8383
Complete(r)
8484

8585
if err != nil {

internal/controllers/machine/machine_controller.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
119119
c, err := ctrl.NewControllerManagedBy(mgr).
120120
For(&clusterv1.Machine{}).
121121
WithOptions(options).
122-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
122+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
123123
Watches(
124124
&clusterv1.Cluster{},
125125
handler.EnqueueRequestsFromMapFunc(clusterToMachines),
@@ -130,7 +130,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
130130
predicates.ClusterUnpaused(predicateLog),
131131
predicates.ClusterControlPlaneInitialized(predicateLog),
132132
),
133-
predicates.ResourceHasFilterLabel(predicateLog, r.WatchFilterValue),
133+
predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue),
134134
),
135135
)).
136136
Watches(
@@ -151,6 +151,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
151151
r.externalTracker = external.ObjectTracker{
152152
Controller: c,
153153
Cache: mgr.GetCache(),
154+
Scheme: mgr.GetScheme(),
154155
}
155156
r.ssaCache = ssa.NewCache()
156157
r.drainCache = drain.NewCache()

internal/controllers/machinedeployment/machinedeployment_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
9393
handler.EnqueueRequestsFromMapFunc(r.MachineSetToDeployments),
9494
).
9595
WithOptions(options).
96-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
96+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
9797
Watches(
9898
&clusterv1.Cluster{},
9999
handler.EnqueueRequestsFromMapFunc(clusterToMachineDeployments),

internal/controllers/machinehealthcheck/machinehealthcheck_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
9393
handler.EnqueueRequestsFromMapFunc(r.machineToMachineHealthCheck),
9494
).
9595
WithOptions(options).
96-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
96+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
9797
Watches(
9898
&clusterv1.Cluster{},
9999
handler.EnqueueRequestsFromMapFunc(r.clusterToMachineHealthCheck),
100100
builder.WithPredicates(
101101
// TODO: should this wait for Cluster.Status.InfrastructureReady similar to Infra Machine resources?
102102
predicates.All(predicateLog,
103103
predicates.ClusterUnpaused(predicateLog),
104-
predicates.ResourceHasFilterLabel(predicateLog, r.WatchFilterValue),
104+
predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue),
105105
),
106106
),
107107
).Build(r)

internal/controllers/machineset/machineset_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
116116
handler.EnqueueRequestsFromMapFunc(r.MachineToMachineSets),
117117
).
118118
WithOptions(options).
119-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
119+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
120120
Watches(
121121
&clusterv1.Cluster{},
122122
handler.EnqueueRequestsFromMapFunc(clusterToMachineSets),
123123
builder.WithPredicates(
124124
// TODO: should this wait for Cluster.Status.InfrastructureReady similar to Infra Machine resources?
125125
predicates.All(predicateLog,
126126
predicates.ClusterUnpaused(predicateLog),
127-
predicates.ResourceHasFilterLabel(predicateLog, r.WatchFilterValue),
127+
predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue),
128128
),
129129
),
130130
).Complete(r)

internal/controllers/topology/cluster/cluster_controller.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
111111
builder.WithPredicates(predicates.ResourceIsTopologyOwned(predicateLog)),
112112
).
113113
WithOptions(options).
114-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
114+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
115115
Build(r)
116116

117117
if err != nil {
@@ -121,6 +121,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
121121
r.externalTracker = external.ObjectTracker{
122122
Controller: c,
123123
Cache: mgr.GetCache(),
124+
Scheme: mgr.GetScheme(),
124125
}
125126
r.desiredStateGenerator = desiredstate.NewGenerator(r.Client, r.Tracker, r.RuntimeClient)
126127
r.recorder = mgr.GetEventRecorderFor("topology/cluster-controller")

internal/controllers/topology/machinedeployment/machinedeployment_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
6969
builder.WithPredicates(
7070
predicates.All(predicateLog,
7171
predicates.ResourceIsTopologyOwned(predicateLog),
72-
predicates.ResourceNotPaused(predicateLog)),
72+
predicates.ResourceNotPaused(mgr.GetScheme(), predicateLog)),
7373
),
7474
).
7575
Named("topology/machinedeployment").
7676
WithOptions(options).
77-
WithEventFilter(predicates.ResourceHasFilterLabel(predicateLog, r.WatchFilterValue)).
77+
WithEventFilter(predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
7878
Watches(
7979
&clusterv1.Cluster{},
8080
handler.EnqueueRequestsFromMapFunc(clusterToMachineDeployments),

internal/controllers/topology/machineset/machineset_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt
7171
builder.WithPredicates(
7272
predicates.All(predicateLog,
7373
predicates.ResourceIsTopologyOwned(predicateLog),
74-
predicates.ResourceNotPaused(predicateLog)),
74+
predicates.ResourceNotPaused(mgr.GetScheme(), predicateLog)),
7575
),
7676
).
7777
Named("topology/machineset").
7878
WithOptions(options).
79-
WithEventFilter(predicates.ResourceHasFilterLabel(predicateLog, r.WatchFilterValue)).
79+
WithEventFilter(predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
8080
Watches(
8181
&clusterv1.Cluster{},
8282
handler.EnqueueRequestsFromMapFunc(clusterToMachineSets),

test/infrastructure/docker/exp/internal/controllers/dockermachinepool_controller.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (r *DockerMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr
176176
c, err := ctrl.NewControllerManagedBy(mgr).
177177
For(&infraexpv1.DockerMachinePool{}).
178178
WithOptions(options).
179-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
179+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
180180
Watches(
181181
&expv1.MachinePool{},
182182
handler.EnqueueRequestsFromMapFunc(utilexp.MachinePoolToInfrastructureMapFunc(ctx,
@@ -201,6 +201,7 @@ func (r *DockerMachinePoolReconciler) SetupWithManager(ctx context.Context, mgr
201201
r.externalTracker = external.ObjectTracker{
202202
Controller: c,
203203
Cache: mgr.GetCache(),
204+
Scheme: mgr.GetScheme(),
204205
}
205206
r.ssaCache = ssa.NewCache()
206207

test/infrastructure/docker/internal/controllers/dockercluster_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (r *DockerClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl
202202
err := ctrl.NewControllerManagedBy(mgr).
203203
For(&infrav1.DockerCluster{}).
204204
WithOptions(options).
205-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
205+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
206206
Watches(
207207
&clusterv1.Cluster{},
208208
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(ctx, infrav1.GroupVersion.WithKind("DockerCluster"), mgr.GetClient(), &infrav1.DockerCluster{})),

test/infrastructure/docker/internal/controllers/dockermachine_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ func (r *DockerMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl
488488
err = ctrl.NewControllerManagedBy(mgr).
489489
For(&infrav1.DockerMachine{}).
490490
WithOptions(options).
491-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
491+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
492492
Watches(
493493
&clusterv1.Machine{},
494494
handler.EnqueueRequestsFromMapFunc(util.MachineToInfrastructureMapFunc(infrav1.GroupVersion.WithKind("DockerMachine"))),

test/infrastructure/inmemory/internal/controllers/inmemorycluster_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func (r *InMemoryClusterReconciler) SetupWithManager(ctx context.Context, mgr ct
212212
err := ctrl.NewControllerManagedBy(mgr).
213213
For(&infrav1.InMemoryCluster{}).
214214
WithOptions(options).
215-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
215+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
216216
Watches(
217217
&clusterv1.Cluster{},
218218
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(ctx, infrav1.GroupVersion.WithKind("InMemoryCluster"), mgr.GetClient(), &infrav1.InMemoryCluster{})),

test/infrastructure/inmemory/internal/controllers/inmemorymachine_controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ func (r *InMemoryMachineReconciler) SetupWithManager(ctx context.Context, mgr ct
11471147
err = ctrl.NewControllerManagedBy(mgr).
11481148
For(&infrav1.InMemoryMachine{}).
11491149
WithOptions(options).
1150-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(predicateLog, r.WatchFilterValue)).
1150+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
11511151
Watches(
11521152
&clusterv1.Machine{},
11531153
handler.EnqueueRequestsFromMapFunc(util.MachineToInfrastructureMapFunc(infrav1.GroupVersion.WithKind("InMemoryMachine"))),

0 commit comments

Comments
 (0)