Skip to content

Commit 32944cf

Browse files
author
Paulo Gomes
authored
Merge pull request #416 from pjbgf/panic-recovery
Enable RecoverPanic
2 parents 2d88b6f + 0fdcf7f commit 32944cf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

controllers/imageupdateautomation_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ type ImageUpdateAutomationReconciler struct {
9696
type ImageUpdateAutomationReconcilerOptions struct {
9797
MaxConcurrentReconciles int
9898
RateLimiter ratelimiter.RateLimiter
99+
RecoverPanic bool
99100
}
100101

101102
// +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
443444
WithOptions(controller.Options{
444445
MaxConcurrentReconciles: opts.MaxConcurrentReconciles,
445446
RateLimiter: opts.RateLimiter,
447+
RecoverPanic: opts.RecoverPanic,
446448
}).
447449
Complete(r)
448450
}

main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ import (
5050
"github.com/fluxcd/image-automation-controller/controllers"
5151
)
5252

53-
const controllerName = "image-automation-controller"
53+
const (
54+
controllerName = "image-automation-controller"
55+
56+
// recoverPanic indicates whether panic caused by reconciles should be recovered.
57+
recoverPanic = true
58+
)
5459

5560
var (
5661
scheme = runtime.NewScheme()
@@ -155,6 +160,7 @@ func main() {
155160
}).SetupWithManager(mgr, controllers.ImageUpdateAutomationReconcilerOptions{
156161
MaxConcurrentReconciles: concurrent,
157162
RateLimiter: helper.GetRateLimiter(rateLimiterOptions),
163+
RecoverPanic: recoverPanic,
158164
}); err != nil {
159165
setupLog.Error(err, "unable to create controller", "controller", "ImageUpdateAutomation")
160166
os.Exit(1)

0 commit comments

Comments
 (0)