Add a controller.Options type
This type is intended to be passed as the argument to most Crossplane Setup functions, for example: ```go func Setup(mgr ctrl.Manager, o controller.Options) error ``` This allows us to add new options to be plumbed down to all or most controllers without increasing the number of arguments provided to each Setup function. Sets of controllers that require additional arguments (e.g. the pkg controllers from crossplane/crossplane) can define their own Options struct that embeds this one. Signed-off-by: Nic Cope <negz@rk0n.org>
This commit is contained in:
parent
6ae31519f1
commit
b7335472cd
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
Copyright 2021 The Crossplane Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
|
||||
"github.com/crossplane/crossplane-runtime/pkg/feature"
|
||||
"github.com/crossplane/crossplane-runtime/pkg/logging"
|
||||
)
|
||||
|
||||
// Options frequently used by most Crossplane controllers.
|
||||
type Options struct {
|
||||
// The Logger controllers should use.
|
||||
Logger logging.Logger
|
||||
|
||||
// The GlobalRateLimiter used by this controller manager. The rate of
|
||||
// reconciles across all controllers will be subject to this limit.
|
||||
GlobalRateLimiter workqueue.RateLimiter
|
||||
|
||||
// PollInterval at which each controller should speculatively poll to
|
||||
// determine whether it has work to do.
|
||||
PollInterval time.Duration
|
||||
|
||||
// MaxConcurrentReconciles for each controller.
|
||||
MaxConcurrentReconciles int
|
||||
|
||||
// Features that should be enabled.
|
||||
Features *feature.Flags
|
||||
}
|
Loading…
Reference in New Issue