Add flags for exponential back-off retry
Signed-off-by: Alex Marston <alexander.marston@gmail.com>
This commit is contained in:
parent
2214d57517
commit
42aaf61852
|
@ -45,6 +45,7 @@ import (
|
||||||
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
|
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/handler"
|
"sigs.k8s.io/controller-runtime/pkg/handler"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
"sigs.k8s.io/controller-runtime/pkg/predicate"
|
||||||
|
"sigs.k8s.io/controller-runtime/pkg/ratelimiter"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/source"
|
"sigs.k8s.io/controller-runtime/pkg/source"
|
||||||
|
|
||||||
|
@ -118,7 +119,10 @@ func (r *HelmReleaseReconciler) SetupWithManager(mgr ctrl.Manager, opts HelmRele
|
||||||
handler.EnqueueRequestsFromMapFunc(r.requestsForHelmChartChange),
|
handler.EnqueueRequestsFromMapFunc(r.requestsForHelmChartChange),
|
||||||
builder.WithPredicates(SourceRevisionChangePredicate{}),
|
builder.WithPredicates(SourceRevisionChangePredicate{}),
|
||||||
).
|
).
|
||||||
WithOptions(controller.Options{MaxConcurrentReconciles: opts.MaxConcurrentReconciles}).
|
WithOptions(controller.Options{
|
||||||
|
MaxConcurrentReconciles: opts.MaxConcurrentReconciles,
|
||||||
|
RateLimiter: opts.RateLimiter,
|
||||||
|
}).
|
||||||
Complete(r)
|
Complete(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,6 +287,7 @@ type HelmReleaseReconcilerOptions struct {
|
||||||
MaxConcurrentReconciles int
|
MaxConcurrentReconciles int
|
||||||
HTTPRetry int
|
HTTPRetry int
|
||||||
DependencyRequeueInterval time.Duration
|
DependencyRequeueInterval time.Duration
|
||||||
|
RateLimiter ratelimiter.RateLimiter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *HelmReleaseReconciler) reconcileRelease(ctx context.Context,
|
func (r *HelmReleaseReconciler) reconcileRelease(ctx context.Context,
|
||||||
|
|
4
main.go
4
main.go
|
@ -32,6 +32,7 @@ import (
|
||||||
|
|
||||||
"github.com/fluxcd/pkg/runtime/acl"
|
"github.com/fluxcd/pkg/runtime/acl"
|
||||||
"github.com/fluxcd/pkg/runtime/client"
|
"github.com/fluxcd/pkg/runtime/client"
|
||||||
|
helper "github.com/fluxcd/pkg/runtime/controller"
|
||||||
"github.com/fluxcd/pkg/runtime/events"
|
"github.com/fluxcd/pkg/runtime/events"
|
||||||
"github.com/fluxcd/pkg/runtime/leaderelection"
|
"github.com/fluxcd/pkg/runtime/leaderelection"
|
||||||
"github.com/fluxcd/pkg/runtime/logger"
|
"github.com/fluxcd/pkg/runtime/logger"
|
||||||
|
@ -74,6 +75,7 @@ func main() {
|
||||||
logOptions logger.Options
|
logOptions logger.Options
|
||||||
aclOptions acl.Options
|
aclOptions acl.Options
|
||||||
leaderElectionOptions leaderelection.Options
|
leaderElectionOptions leaderelection.Options
|
||||||
|
rateLimiterOptions helper.RateLimiterOptions
|
||||||
defaultServiceAccount string
|
defaultServiceAccount string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -90,6 +92,7 @@ func main() {
|
||||||
logOptions.BindFlags(flag.CommandLine)
|
logOptions.BindFlags(flag.CommandLine)
|
||||||
aclOptions.BindFlags(flag.CommandLine)
|
aclOptions.BindFlags(flag.CommandLine)
|
||||||
leaderElectionOptions.BindFlags(flag.CommandLine)
|
leaderElectionOptions.BindFlags(flag.CommandLine)
|
||||||
|
rateLimiterOptions.BindFlags(flag.CommandLine)
|
||||||
kubeConfigOpts.BindFlags(flag.CommandLine)
|
kubeConfigOpts.BindFlags(flag.CommandLine)
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
@ -148,6 +151,7 @@ func main() {
|
||||||
MaxConcurrentReconciles: concurrent,
|
MaxConcurrentReconciles: concurrent,
|
||||||
DependencyRequeueInterval: requeueDependency,
|
DependencyRequeueInterval: requeueDependency,
|
||||||
HTTPRetry: httpRetry,
|
HTTPRetry: httpRetry,
|
||||||
|
RateLimiter: helper.GetRateLimiter(rateLimiterOptions),
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
setupLog.Error(err, "unable to create controller", "controller", v2.HelmReleaseKind)
|
setupLog.Error(err, "unable to create controller", "controller", v2.HelmReleaseKind)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
Loading…
Reference in New Issue