-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make max concurrent reconciles configurable and increase the default …
…value (#19) * Make max concurrent reconciles configurable and increase the default value * Drop unit tests for AddToManager * Address review comments * Address review comments (2)
- Loading branch information
1 parent
a59ec55
commit 67b46de
Showing
6 changed files
with
106 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package input | ||
|
||
import ( | ||
"github.com/spf13/pflag" | ||
"sigs.k8s.io/controller-runtime/pkg/controller" | ||
) | ||
|
||
// ControllerOptions are command line options that can be set for controller.Options. | ||
type ControllerOptions struct { | ||
// MaxConcurrentReconciles are the maximum concurrent reconciles. | ||
MaxConcurrentReconciles int | ||
|
||
config *ControllerConfig | ||
} | ||
|
||
// AddFlags implements Flagger.AddFlags. | ||
func (c *ControllerOptions) AddFlags(fs *pflag.FlagSet, prefix string) { | ||
fs.IntVar(&c.MaxConcurrentReconciles, prefix+"max-concurrent-reconciles", c.MaxConcurrentReconciles, "The maximum number of concurrent reconciliations.") | ||
} | ||
|
||
// Complete implements Completer.Complete. | ||
func (c *ControllerOptions) Complete() error { | ||
c.config = &ControllerConfig{ | ||
MaxConcurrentReconciles: c.MaxConcurrentReconciles, | ||
} | ||
return nil | ||
} | ||
|
||
// Completed returns the completed ControllerConfig. Only call this if `Complete` was successful. | ||
func (c *ControllerOptions) Completed() *ControllerConfig { | ||
return c.config | ||
} | ||
|
||
// ControllerConfig is a completed controller configuration. | ||
type ControllerConfig struct { | ||
// MaxConcurrentReconciles is the maximum number of concurrent reconciles. | ||
MaxConcurrentReconciles int | ||
} | ||
|
||
// Apply sets the values of this ControllerConfig in the given AddOptions. | ||
func (c *ControllerConfig) Apply(opts *controller.Options) { | ||
opts.MaxConcurrentReconciles = c.MaxConcurrentReconciles | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters