Skip to content

Commit

Permalink
Merge pull request #570 from fluxcd/fix-graceful-shutdown
Browse files Browse the repository at this point in the history
Allow overriding ctrl manager graceful shutdown timeout
  • Loading branch information
hiddeco authored Dec 9, 2022
2 parents 8d1afa6 + e242bb0 commit 3340022
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,28 @@ func init() {

func main() {
var (
metricsAddr string
eventsAddr string
healthAddr string
concurrent int
requeueDependency time.Duration
watchAllNamespaces bool
httpRetry int
clientOptions client.Options
kubeConfigOpts client.KubeConfigOptions
logOptions logger.Options
aclOptions acl.Options
leaderElectionOptions leaderelection.Options
rateLimiterOptions helper.RateLimiterOptions
metricsAddr string
eventsAddr string
healthAddr string
concurrent int
requeueDependency time.Duration
gracefulShutdownTimeout time.Duration
watchAllNamespaces bool
httpRetry int
clientOptions client.Options
kubeConfigOpts client.KubeConfigOptions
logOptions logger.Options
aclOptions acl.Options
leaderElectionOptions leaderelection.Options
rateLimiterOptions helper.RateLimiterOptions
)

flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&eventsAddr, "events-addr", "", "The address of the events receiver.")
flag.StringVar(&healthAddr, "health-addr", ":9440", "The address the health endpoint binds to.")
flag.IntVar(&concurrent, "concurrent", 4, "The number of concurrent HelmRelease reconciles.")
flag.DurationVar(&requeueDependency, "requeue-dependency", 30*time.Second, "The interval at which failing dependencies are reevaluated.")
flag.DurationVar(&gracefulShutdownTimeout, "graceful-shutdown-timeout", 0, "The duration given to the reconciler to finish before forcibly stopping.")
flag.BoolVar(&watchAllNamespaces, "watch-all-namespaces", true,
"Watch for custom resources in all namespaces, if set to false it will only watch the runtime namespace.")
flag.IntVar(&httpRetry, "http-retry", 9, "The maximum number of retries when failing to fetch artifacts over HTTP.")
Expand Down Expand Up @@ -120,6 +122,7 @@ func main() {
LeaseDuration: &leaderElectionOptions.LeaseDuration,
RenewDeadline: &leaderElectionOptions.RenewDeadline,
RetryPeriod: &leaderElectionOptions.RetryPeriod,
GracefulShutdownTimeout: &gracefulShutdownTimeout,
LeaderElectionID: fmt.Sprintf("%s-leader-election", controllerName),
Namespace: watchNamespace,
Logger: ctrl.Log,
Expand Down

0 comments on commit 3340022

Please sign in to comment.