New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
⚠️ Support global controller options in component config #1371
Merged
k8s-ci-robot
merged 1 commit into
kubernetes-sigs:master
from
vincepri:expose-controller-componentconfig
Feb 5, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ limitations under the License. | |
package v1alpha1 | ||
|
||
import ( | ||
"time" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
configv1alpha1 "k8s.io/component-base/config/v1alpha1" | ||
|
@@ -50,9 +52,14 @@ type ControllerManagerConfigurationSpec struct { | |
// GracefulShutdownTimeout is the duration given to runnable to stop before the manager actually returns on stop. | ||
// To disable graceful shutdown, set to time.Duration(0) | ||
// To use graceful shutdown without timeout, set to a negative duration, e.G. time.Duration(-1) | ||
// The graceful shutdown is skipped for safety reasons in case the leadere election lease is lost. | ||
// The graceful shutdown is skipped for safety reasons in case the leader election lease is lost. | ||
GracefulShutdownTimeout *metav1.Duration `json:"gracefulShutDown,omitempty"` | ||
|
||
// Controller contains global configuration options for controllers | ||
// registered within this manager. | ||
// +optional | ||
Controller *ControllerConfigurationSpec `json:"controller,omitempty"` | ||
|
||
// Metrics contains thw controller metrics configuration | ||
// +optional | ||
Metrics ControllerMetrics `json:"metrics,omitempty"` | ||
|
@@ -66,6 +73,29 @@ type ControllerManagerConfigurationSpec struct { | |
Webhook ControllerWebhook `json:"webhook,omitempty"` | ||
} | ||
|
||
// ControllerConfigurationSpec defines the global configuration for | ||
// controllers registered with the manager. | ||
type ControllerConfigurationSpec struct { | ||
// GroupKindConcurrency is a map from a Kind to the number of concurrent reconciliation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Love this idea, this will make it much easier to make per type configs. |
||
// allowed for that controller. | ||
// | ||
// When a controller is registered within this manager using the builder utilities, | ||
// users have to specify the type the controller reconciles in the For(...) call. | ||
// If the object's kind passed matches one of the keys in this map, the concurrency | ||
// for that controller is set to the number specified. | ||
// | ||
// The key is expected to be consistent in form with GroupKind.String(), | ||
// e.g. ReplicaSet in apps group (regardless of version) would be `ReplicaSet.apps`. | ||
// | ||
// +optional | ||
GroupKindConcurrency map[string]int `json:"groupKindConcurrency,omitempty"` | ||
|
||
// CacheSyncTimeout refers to the time limit set to wait for syncing caches. | ||
// Defaults to 2 minutes if not set. | ||
// +optional | ||
CacheSyncTimeout *time.Duration `json:"cacheSyncTimeout,omitempty"` | ||
} | ||
|
||
// ControllerMetrics defines the metrics configs | ||
type ControllerMetrics struct { | ||
// BindAddress is the TCP address that the controller should bind to | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the description, you called this out as a breaking change but all the fields have optional? Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The manager's interface new method addition is a breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically, https://github.com/kubernetes-sigs/controller-runtime/pull/1371/files#diff-d500fbd6a2aa620607ca5e2a7c3ac4f1a4c82309d1a549561e92abfcb18f2f0eR93-R95
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. For the most part the docs (at least the ones in Kubebuilder on
master
) point to embedding the core type so hopefully, anyone that has gone and implemented this would be able to receive the update to resolve this but for folks that aren't that makes sense. luckily we're still alpha 🎉