Documentation ¶
Index ¶
- Constants
- type CombinedResult
- type ComponentReconciler
- type DefaultReconciledComponent
- type DesiredState
- type DesiredStateHook
- type Dispatcher
- type GenericResourceReconciler
- func (r *GenericResourceReconciler) CreateIfNotExist(desired runtime.Object) (bool, runtime.Object, error)
- func (r *GenericResourceReconciler) CreateResource(desired runtime.Object) error
- func (r *GenericResourceReconciler) ReconcileResource(desired runtime.Object, desiredState DesiredState) (*reconcile.Result, error)
- type NativeReconciledComponent
- type NativeReconciler
- type NativeReconcilerOpt
- type ReconcileRetry
- type ReconcilerOpts
- type ResourceBuilder
- type ResourceBuilders
- type ResourceOwner
- type ResourceReconciler
- type ResourceReconcilerOption
- type StaticDesiredState
Constants ¶
const BanzaiCloudManagedComponent = "banzaicloud.io/managed-component"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CombinedResult ¶ added in v0.7.0
Collects results and errors of all subcomponents instead of failing and bailing out immediately
func (*CombinedResult) Combine ¶ added in v0.7.0
func (c *CombinedResult) Combine(sub *reconcile.Result, err error)
func (*CombinedResult) CombineErr ¶ added in v0.7.0
func (c *CombinedResult) CombineErr(err error)
type ComponentReconciler ¶ added in v0.7.0
type DefaultReconciledComponent ¶ added in v0.7.0
type DefaultReconciledComponent struct {
// contains filtered or unexported fields
}
func (*DefaultReconciledComponent) PurgeTypes ¶ added in v0.7.0
func (d *DefaultReconciledComponent) PurgeTypes() []schema.GroupVersionKind
func (*DefaultReconciledComponent) RegisterWatches ¶ added in v0.7.0
func (d *DefaultReconciledComponent) RegisterWatches(b *builder.Builder)
func (*DefaultReconciledComponent) ResourceBuilders ¶ added in v0.7.0
func (d *DefaultReconciledComponent) ResourceBuilders(parent ResourceOwner, object interface{}) []ResourceBuilder
type DesiredState ¶
type DesiredStateHook ¶
func (DesiredStateHook) BeforeUpdate ¶
func (d DesiredStateHook) BeforeUpdate(object runtime.Object) error
type Dispatcher ¶ added in v0.7.0
type Dispatcher struct { client.Client Log logr.Logger ResourceGetter func(req ctrl.Request) (runtime.Object, error) ResourceFilter func(runtime.Object) (bool, error) CompletionHandler func(runtime.Object, ctrl.Result, error) (ctrl.Result, error) ComponentReconcilers []ComponentReconciler }
Dispatcher orchestrates reconciliation of multiple ComponentReconciler objects focusing on handing off reconciled object to all of its components and calculating an aggregated result to return. It requires a ResourceGetter callback and optionally can leverage a ResourceFilter and a CompletionHandler
func (*Dispatcher) Handle ¶ added in v0.7.0
Handle receives a single object and dispatches it to all the components Components need to understand how to interpret the object
func (*Dispatcher) Reconcile ¶ added in v0.7.0
Reconcile implements reconcile.Reconciler in a generic way from the controller-runtime library
func (*Dispatcher) RegisterWatches ¶ added in v0.7.0
func (r *Dispatcher) RegisterWatches(b *builder.Builder) *builder.Builder
RegisterWatches dispatches the watch registration builder to all its components
type GenericResourceReconciler ¶
type GenericResourceReconciler struct { Log logr.Logger Client runtimeClient.Client Options ReconcilerOpts }
GenericResourceReconciler generic resource reconciler
func NewReconciler ¶
func NewReconciler(client runtimeClient.Client, log logr.Logger, opts ReconcilerOpts) *GenericResourceReconciler
NewReconciler returns GenericResourceReconciler
func (*GenericResourceReconciler) CreateIfNotExist ¶ added in v0.7.0
func (*GenericResourceReconciler) CreateResource ¶
func (r *GenericResourceReconciler) CreateResource(desired runtime.Object) error
CreateResource creates a resource if it doesn't exist
func (*GenericResourceReconciler) ReconcileResource ¶
func (r *GenericResourceReconciler) ReconcileResource(desired runtime.Object, desiredState DesiredState) (*reconcile.Result, error)
ReconcileResource reconciles various kubernetes types
type NativeReconciledComponent ¶ added in v0.7.0
type NativeReconciledComponent interface { ResourceBuilders(parent ResourceOwner, object interface{}) []ResourceBuilder RegisterWatches(*builder.Builder) PurgeTypes() []schema.GroupVersionKind }
func NewReconciledComponent ¶ added in v0.7.0
func NewReconciledComponent(b ResourceBuilders, w func(b *builder.Builder), p func() []schema.GroupVersionKind) NativeReconciledComponent
type NativeReconciler ¶ added in v0.7.0
type NativeReconciler struct { *GenericResourceReconciler client.Client // contains filtered or unexported fields }
func NewNativeReconciler ¶ added in v0.7.0
func NewNativeReconciler( componentName string, rec *GenericResourceReconciler, client client.Client, reconciledComponent NativeReconciledComponent, resourceTranslate func(runtime.Object) (parent ResourceOwner, config interface{}), opts ...NativeReconcilerOpt) *NativeReconciler
func (*NativeReconciler) RegisterWatches ¶ added in v0.7.0
func (rec *NativeReconciler) RegisterWatches(b *builder.Builder)
type NativeReconcilerOpt ¶ added in v0.7.0
type NativeReconcilerOpt func(*NativeReconciler)
func NativeReconcilerSetControllerRef ¶ added in v0.10.0
func NativeReconcilerSetControllerRef() NativeReconcilerOpt
func NativeReconcilerWithScheme ¶ added in v0.7.0
func NativeReconcilerWithScheme(scheme *runtime.Scheme) NativeReconcilerOpt
type ReconcileRetry ¶ added in v0.7.0
type ReconcilerOpts ¶
type ReconcilerOpts struct { Log logr.Logger Scheme *runtime.Scheme EnableRecreateWorkloadOnImmutableFieldChange bool EnableRecreateWorkloadOnImmutableFieldChangeHelp string }
Recommended to use NewReconcilerWith + ResourceReconcilerOptions
type ResourceBuilder ¶ added in v0.7.0
type ResourceBuilder func() (runtime.Object, DesiredState, error)
type ResourceBuilders ¶ added in v0.7.0
type ResourceBuilders func(parent ResourceOwner, object interface{}) []ResourceBuilder
type ResourceOwner ¶ added in v0.7.0
type ResourceReconciler ¶ added in v0.7.0
type ResourceReconciler interface { CreateIfNotExist(runtime.Object) (created bool, object runtime.Object, err error) ReconcileResource(runtime.Object, DesiredState) (*reconcile.Result, error) }
func NewReconcilerWith ¶ added in v0.7.0
func NewReconcilerWith(client runtimeClient.Client, opts ...func(reconciler *ReconcilerOpts)) ResourceReconciler
type ResourceReconcilerOption ¶ added in v0.7.0
type ResourceReconcilerOption func(*ReconcilerOpts)
func WithEnableRecreateWorkload ¶ added in v0.7.0
func WithEnableRecreateWorkload() ResourceReconcilerOption
func WithLog ¶ added in v0.7.0
func WithLog(log logr.Logger) ResourceReconcilerOption
func WithScheme ¶ added in v0.7.0
func WithScheme(scheme *runtime.Scheme) ResourceReconcilerOption
type StaticDesiredState ¶
type StaticDesiredState string
const ( StateAbsent StaticDesiredState = "Absent" StatePresent StaticDesiredState = "Present" )
func (StaticDesiredState) BeforeUpdate ¶
func (s StaticDesiredState) BeforeUpdate(object runtime.Object) error