Enable RecoverPanic
The controller-runtime provides the ability to recover from panics that have arisen from a reconciliation. This change enables this functionality by default. Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
This commit is contained in:
parent
2d88b6f3ff
commit
0fdcf7fe6d
|
@ -96,6 +96,7 @@ type ImageUpdateAutomationReconciler struct {
|
|||
type ImageUpdateAutomationReconcilerOptions struct {
|
||||
MaxConcurrentReconciles int
|
||||
RateLimiter ratelimiter.RateLimiter
|
||||
RecoverPanic bool
|
||||
}
|
||||
|
||||
// +kubebuilder:rbac:groups=image.toolkit.fluxcd.io,resources=imageupdateautomations,verbs=get;list;watch;create;update;patch;delete
|
||||
|
@ -443,6 +444,7 @@ func (r *ImageUpdateAutomationReconciler) SetupWithManager(mgr ctrl.Manager, opt
|
|||
WithOptions(controller.Options{
|
||||
MaxConcurrentReconciles: opts.MaxConcurrentReconciles,
|
||||
RateLimiter: opts.RateLimiter,
|
||||
RecoverPanic: opts.RecoverPanic,
|
||||
}).
|
||||
Complete(r)
|
||||
}
|
||||
|
|
8
main.go
8
main.go
|
@ -50,7 +50,12 @@ import (
|
|||
"github.com/fluxcd/image-automation-controller/controllers"
|
||||
)
|
||||
|
||||
const controllerName = "image-automation-controller"
|
||||
const (
|
||||
controllerName = "image-automation-controller"
|
||||
|
||||
// recoverPanic indicates whether panic caused by reconciles should be recovered.
|
||||
recoverPanic = true
|
||||
)
|
||||
|
||||
var (
|
||||
scheme = runtime.NewScheme()
|
||||
|
@ -155,6 +160,7 @@ func main() {
|
|||
}).SetupWithManager(mgr, controllers.ImageUpdateAutomationReconcilerOptions{
|
||||
MaxConcurrentReconciles: concurrent,
|
||||
RateLimiter: helper.GetRateLimiter(rateLimiterOptions),
|
||||
RecoverPanic: recoverPanic,
|
||||
}); err != nil {
|
||||
setupLog.Error(err, "unable to create controller", "controller", "ImageUpdateAutomation")
|
||||
os.Exit(1)
|
||||
|
|
Loading…
Reference in New Issue