diff --git a/images/virtualization-artifact/pkg/controller/cvi/cvi_controller.go b/images/virtualization-artifact/pkg/controller/cvi/cvi_controller.go index a22ff908e..2f34ba072 100644 --- a/images/virtualization-artifact/pkg/controller/cvi/cvi_controller.go +++ b/images/virtualization-artifact/pkg/controller/cvi/cvi_controller.go @@ -21,6 +21,7 @@ import ( "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/manager" @@ -71,7 +72,7 @@ func NewController( internal.NewAttacheeHandler(mgr.GetClient()), ) - cviController, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: reconciler}) + cviController, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: reconciler, RecoverPanic: ptr.To(true)}) if err != nil { return nil, err } diff --git a/images/virtualization-artifact/pkg/controller/vd/vd_controller.go b/images/virtualization-artifact/pkg/controller/vd/vd_controller.go index 4fbbafca0..a5d1b7fcb 100644 --- a/images/virtualization-artifact/pkg/controller/vd/vd_controller.go +++ b/images/virtualization-artifact/pkg/controller/vd/vd_controller.go @@ -22,6 +22,7 @@ import ( "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/controller" @@ -82,7 +83,7 @@ func NewController( internal.NewStatsHandler(stat, importer, uploader), ) - vdController, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: reconciler}) + vdController, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: reconciler, RecoverPanic: ptr.To(true)}) if err != nil { return nil, err } diff --git a/images/virtualization-artifact/pkg/controller/vi/vi_controller.go b/images/virtualization-artifact/pkg/controller/vi/vi_controller.go index d35c65c8f..0befcd937 100644 --- a/images/virtualization-artifact/pkg/controller/vi/vi_controller.go +++ b/images/virtualization-artifact/pkg/controller/vi/vi_controller.go @@ -21,6 +21,7 @@ import ( "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/manager" @@ -70,7 +71,7 @@ func NewController( internal.NewAttacheeHandler(mgr.GetClient()), ) - viController, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: reconciler}) + viController, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: reconciler, RecoverPanic: ptr.To(true)}) if err != nil { return nil, err } diff --git a/images/virtualization-artifact/pkg/controller/vm/vm_controller.go b/images/virtualization-artifact/pkg/controller/vm/vm_controller.go index 92747eeda..60e1b002b 100644 --- a/images/virtualization-artifact/pkg/controller/vm/vm_controller.go +++ b/images/virtualization-artifact/pkg/controller/vm/vm_controller.go @@ -20,6 +20,7 @@ import ( "context" "log/slog" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/controller" @@ -65,7 +66,7 @@ func NewController( } r := NewReconciler(client, logger, handlers...) - c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r}) + c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r, RecoverPanic: ptr.To(true)}) if err != nil { return nil, err } diff --git a/images/virtualization-artifact/pkg/controller/vmbda/vmbda_controller.go b/images/virtualization-artifact/pkg/controller/vmbda/vmbda_controller.go index 451609ebc..707142f3e 100644 --- a/images/virtualization-artifact/pkg/controller/vmbda/vmbda_controller.go +++ b/images/virtualization-artifact/pkg/controller/vmbda/vmbda_controller.go @@ -21,6 +21,7 @@ import ( "log/slog" "github.com/go-logr/logr" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/controller" @@ -54,7 +55,7 @@ func NewController( internal.NewDeletionHandler(), ) - vmbdaController, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: reconciler}) + vmbdaController, err := controller.New(ControllerName, mgr, controller.Options{Reconciler: reconciler, RecoverPanic: ptr.To(true)}) if err != nil { return nil, err } diff --git a/images/virtualization-artifact/pkg/controller/vmclass/vmclass_controller.go b/images/virtualization-artifact/pkg/controller/vmclass/vmclass_controller.go index ba5025e45..3827c9d39 100644 --- a/images/virtualization-artifact/pkg/controller/vmclass/vmclass_controller.go +++ b/images/virtualization-artifact/pkg/controller/vmclass/vmclass_controller.go @@ -20,6 +20,7 @@ import ( "context" "log/slog" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/manager" @@ -49,7 +50,7 @@ func NewController( } r := NewReconciler(client, logger, handlers...) - c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r}) + c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r, RecoverPanic: ptr.To(true)}) if err != nil { return nil, err } diff --git a/images/virtualization-artifact/pkg/controller/vmip/vmip_controller.go b/images/virtualization-artifact/pkg/controller/vmip/vmip_controller.go index cbd12aa58..623033f19 100644 --- a/images/virtualization-artifact/pkg/controller/vmip/vmip_controller.go +++ b/images/virtualization-artifact/pkg/controller/vmip/vmip_controller.go @@ -20,6 +20,7 @@ import ( "context" "github.com/go-logr/logr" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/manager" @@ -55,7 +56,7 @@ func NewController( return nil, err } - c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r}) + c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r, RecoverPanic: ptr.To(true)}) if err != nil { return nil, err } diff --git a/images/virtualization-artifact/pkg/controller/vmiplease/vmiplease_controller.go b/images/virtualization-artifact/pkg/controller/vmiplease/vmiplease_controller.go index 880a0798d..aadb6c433 100644 --- a/images/virtualization-artifact/pkg/controller/vmiplease/vmiplease_controller.go +++ b/images/virtualization-artifact/pkg/controller/vmiplease/vmiplease_controller.go @@ -21,6 +21,7 @@ import ( "time" "github.com/go-logr/logr" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/manager" @@ -54,7 +55,7 @@ func NewController( r := NewReconciler(mgr.GetClient(), log, handlers...) - c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r}) + c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r, RecoverPanic: ptr.To(true)}) if err != nil { return nil, err } diff --git a/images/virtualization-artifact/pkg/controller/vmop/vmop_controller.go b/images/virtualization-artifact/pkg/controller/vmop/vmop_controller.go index 27e5bc49c..4f8ebaa62 100644 --- a/images/virtualization-artifact/pkg/controller/vmop/vmop_controller.go +++ b/images/virtualization-artifact/pkg/controller/vmop/vmop_controller.go @@ -22,6 +22,7 @@ import ( "github.com/go-logr/logr" "k8s.io/client-go/util/workqueue" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/builder" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/manager" @@ -53,8 +54,9 @@ func NewController( }) c, err := controller.New(controllerName, mgr, controller.Options{ - Reconciler: reconcilerCore, - RateLimiter: workqueue.NewItemExponentialFailureRateLimiter(time.Second, 32*time.Second), + Reconciler: reconcilerCore, + RateLimiter: workqueue.NewItemExponentialFailureRateLimiter(time.Second, 32*time.Second), + RecoverPanic: ptr.To(true), }) if err != nil { return nil, err