Skip to content

Commit

Permalink
rebase: use new controller.Watch() API
Browse files Browse the repository at this point in the history
controller-runtime changed the format of the controller.Watch()
function, so that needs adjusting.

See-also: kubernetes-sigs/controller-runtime#2783
Signed-off-by: Niels de Vos <ndevos@ibm.com>
  • Loading branch information
nixpanic committed Apr 30, 2024
1 parent 4eeb450 commit 81044ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/controller/persistentvolume/persistentvolume.go
Expand Up @@ -82,7 +82,13 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
}

// Watch for changes to PersistentVolumes
err = c.Watch(source.Kind(mgr.GetCache(), &corev1.PersistentVolume{}), &handler.EnqueueRequestForObject{})
err = c.Watch(source.Kind(
mgr.GetCache(),
&corev1.PersistentVolume{},
handler.TypedEnqueueRequestForOwner[*corev1.PersistentVolume](
mgr.GetScheme(), mgr.GetRESTMapper(), &corev1.PersistentVolume{},
),
))
if err != nil {
return fmt.Errorf("failed to watch the changes: %w", err)
}
Expand Down

0 comments on commit 81044ed

Please sign in to comment.