Skip to content

Commit

Permalink
feat: add retry count var (#252)
Browse files Browse the repository at this point in the history
Signed-off-by: ericsyh <[email protected]>
  • Loading branch information
ericsyh authored Sep 4, 2024
1 parent baaba51 commit 9cb8814
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ func main() {
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
var retryCount int
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.IntVar(&retryCount, "retry-count", 5, "The number of retries in case of error.")
opts := k8szap.Options{}
opts.BindFlags(flag.CommandLine)
flag.Parse()
Expand Down Expand Up @@ -106,7 +108,7 @@ func main() {
Log: ctrl.Log.WithName("controllers").WithName("PulsarConnection"),
Recorder: mgr.GetEventRecorderFor("pulsarconnection-controller"),
PulsarAdminCreator: admin.NewPulsarAdmin,
Retryer: utils.NewReconcileRetryer(5, utils.NewEventSource(ctrl.Log.WithName("eventSource"))),
Retryer: utils.NewReconcileRetryer(retryCount, utils.NewEventSource(ctrl.Log.WithName("eventSource"))),
}).SetupWithManager(mgr, controller.Options{MaxConcurrentReconciles: 1}); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "PulsarConnection")
os.Exit(1)
Expand Down

0 comments on commit 9cb8814

Please sign in to comment.