Documentation
¶
Overview ¶
Package controllers implements the lazy loader logic for Katanomi.
Package controllers implements the lazy loader logic for Katanomi.
Package controllers implements the lazy loader logic for Katanomi.
Index ¶
- Constants
- func ApplyControllerBuilderOptions(builder *builder.Builder, funcs ...ControllerBuilderOption) *builder.Builder
- func BuilderOptions(opts ...BuilderOptionFunc) controller.Options
- func CreateOrGetWithRetry(ctx context.Context, clt client.Client, obj client.Object) error
- func DefaultOptions() controller.Options
- func DefaultRateLimiter() workqueue.RateLimiter
- func HasControllerReferenceByObjectReference(obj metav1.Object, ref *corev1.ObjectReference, controller bool) bool
- func RateLimiterCtx(ctx context.Context) workqueue.RateLimiter
- func ReconcileRequestCtx(ctx context.Context) ctrl.Request
- func WithRateLimiter(ctx context.Context, rl workqueue.RateLimiter) context.Context
- func WithReconcileRequest(ctx context.Context, key ctrl.Request) context.Context
- type BuilderOptionFunc
- type ControllerBuilderOption
- type ControllerChecker
- type DependencyCheckerInterface
- type Interface
- type LazyLoader
- type SetupChecker
Constants ¶
const DefaultMaxConcurrentReconciles = 10
DefaultMaxConcurrentReconciles is the default number of max concurrent reconciles
Variables ¶
This section is empty.
Functions ¶
func ApplyControllerBuilderOptions ¶ added in v0.9.0
func ApplyControllerBuilderOptions(builder *builder.Builder, funcs ...ControllerBuilderOption) *builder.Builder
ApplyControllerBuilderOptions applies the given options to the controller builder
func BuilderOptions ¶ added in v0.9.0
func BuilderOptions(opts ...BuilderOptionFunc) controller.Options
BuilderOptions returns a functional set of options with conservative defaults.
func CreateOrGetWithRetry ¶ added in v0.9.0
CreateOrGetWithRetry will retry to create source multi times if encounter error however if error is alreadyExist then will get the resource and return it
func DefaultOptions ¶ added in v0.9.0
func DefaultOptions() controller.Options
DefaultOptions returns the default options for the controller
func DefaultRateLimiter ¶
func DefaultRateLimiter() workqueue.RateLimiter
DefaultRateLimiter returns a workqueue rate limiter with a starting value of 2 seconds opposed to controller-runtime's default one of 1 millisecond
func HasControllerReferenceByObjectReference ¶
func HasControllerReferenceByObjectReference(obj metav1.Object, ref *corev1.ObjectReference, controller bool) bool
HasControllerReferenceByObjectReference has controller owner reference
func RateLimiterCtx ¶
func RateLimiterCtx(ctx context.Context) workqueue.RateLimiter
RateLimiterCtx retrieves a RateLimiter from context. Returns nil if none
func ReconcileRequestCtx ¶
ReconcileRequestCtx retrieves a Request key from context returns an empty object if none
func WithRateLimiter ¶
WithRateLimiter stores a RateLimiter into context
Types ¶
type BuilderOptionFunc ¶ added in v0.9.0
type BuilderOptionFunc func(options controller.Options) controller.Options
BuilderOptionFunc is a function that can be used to configure the controller builder options
func MaxConCurrentReconciles ¶ added in v0.9.0
func MaxConCurrentReconciles(num int) BuilderOptionFunc
MaxConCurrentReconciles sets the max concurrent reconciles
func RateLimiter ¶ added in v0.9.0
func RateLimiter(rl ratelimiter.RateLimiter) BuilderOptionFunc
RateLimiter sets the rate limiter
type ControllerBuilderOption ¶ added in v0.9.0
ControllerBuilderOption is a function that can be used to configure the controller builder
func WithBuilderOptions ¶ added in v0.9.0
func WithBuilderOptions(opts controller.Options) ControllerBuilderOption
WithBuilderOptions returns a ControllerBuilderOption that applies the given options to the controller builder
type ControllerChecker ¶ added in v0.9.0
type ControllerChecker interface { DependencyCheckerInterface SetupChecker }
type DependencyCheckerInterface ¶ added in v0.9.0
type DependencyCheckerInterface interface {
DependentCrdInstalled(ctx context.Context, logger *zap.SugaredLogger) (bool, error)
}
DependencyCheckerInterface is the interface for checking dependencies
type Interface ¶
type Interface interface { Name() string Setup(context.Context, manager.Manager, *zap.SugaredLogger) error }
Interface is a basic interface that every reconciler should implement to create a new controller and startup in the controller manager
type LazyLoader ¶
type LazyLoader interface { LazyLoad(context.Context, manager.Manager, *zap.SugaredLogger, SetupChecker) error Start(context.Context) error }
LazyLoader loads whenever dependencies are ready
func NewLazyLoader ¶
func NewLazyLoader(ctx context.Context, interval time.Duration) LazyLoader
NewLazyLoader constructs new LazyLoader for controllers
type SetupChecker ¶
type SetupChecker interface { Interface CheckSetup(context.Context, manager.Manager, *zap.SugaredLogger) error }
SetupChecker controllers with dependencies on other resources will need to implement this interface to allow lazy loading