Documentation
¶
Index ¶
- Constants
- Variables
- func SetupIndexerWithManager(mgr ctrl.Manager, indexers ...Indexer) (err error)
- type BaseReconciler
- type BasicController
- type BasicMultiPhaseDiff
- func (h *BasicMultiPhaseDiff) AddDiff(diff string)
- func (h *BasicMultiPhaseDiff) Diff() string
- func (h *BasicMultiPhaseDiff) GetObjectsToCreate() []client.Object
- func (h *BasicMultiPhaseDiff) GetObjectsToDelete() []client.Object
- func (h *BasicMultiPhaseDiff) GetObjectsToUpdate() []client.Object
- func (h *BasicMultiPhaseDiff) IsDiff() bool
- func (h *BasicMultiPhaseDiff) NeedCreate() bool
- func (h *BasicMultiPhaseDiff) NeedDelete() bool
- func (h *BasicMultiPhaseDiff) NeedUpdate() bool
- func (h *BasicMultiPhaseDiff) SetObjectsToCreate(objects []client.Object)
- func (h *BasicMultiPhaseDiff) SetObjectsToDelete(objects []client.Object)
- func (h *BasicMultiPhaseDiff) SetObjectsToUpdate(objects []client.Object)
- type BasicMultiPhaseRead
- type BasicMultiPhaseReconciler
- type BasicMultiPhaseReconcilerAction
- func (h *BasicMultiPhaseReconcilerAction) Configure(ctx context.Context, req ctrl.Request, o object.MultiPhaseObject) (res ctrl.Result, err error)
- func (h *BasicMultiPhaseReconcilerAction) Delete(ctx context.Context, o object.MultiPhaseObject, data map[string]any) (err error)
- func (h *BasicMultiPhaseReconcilerAction) OnError(ctx context.Context, o object.MultiPhaseObject, data map[string]any, ...) (res ctrl.Result, err error)
- func (h *BasicMultiPhaseReconcilerAction) OnSuccess(ctx context.Context, o object.MultiPhaseObject, data map[string]any) (res ctrl.Result, err error)
- func (h *BasicMultiPhaseReconcilerAction) Read(ctx context.Context, o object.MultiPhaseObject, data map[string]any) (res ctrl.Result, err error)
- type BasicMultiPhaseStepReconciler
- type BasicMultiPhaseStepReconcilerAction
- func (h *BasicMultiPhaseStepReconcilerAction) Configure(ctx context.Context, req ctrl.Request, o object.MultiPhaseObject) (res ctrl.Result, err error)
- func (h *BasicMultiPhaseStepReconcilerAction) Create(ctx context.Context, o object.MultiPhaseObject, data map[string]any, ...) (res ctrl.Result, err error)
- func (h *BasicMultiPhaseStepReconcilerAction) Delete(ctx context.Context, o object.MultiPhaseObject, data map[string]any, ...) (res ctrl.Result, err error)
- func (h *BasicMultiPhaseStepReconcilerAction) Diff(ctx context.Context, o object.MultiPhaseObject, read MultiPhaseRead, ...) (diff MultiPhaseDiff, res ctrl.Result, err error)
- func (h *BasicMultiPhaseStepReconcilerAction) GetIgnoresDiff() []patch.CalculateOption
- func (h *BasicMultiPhaseStepReconcilerAction) GetPhaseName() shared.PhaseName
- func (h *BasicMultiPhaseStepReconcilerAction) OnError(ctx context.Context, o object.MultiPhaseObject, data map[string]any, ...) (res ctrl.Result, err error)
- func (h *BasicMultiPhaseStepReconcilerAction) OnSuccess(ctx context.Context, o object.MultiPhaseObject, data map[string]any, ...) (res ctrl.Result, err error)
- func (h *BasicMultiPhaseStepReconcilerAction) Read(ctx context.Context, o object.MultiPhaseObject, data map[string]any) (read MultiPhaseRead, res ctrl.Result, err error)
- func (h *BasicMultiPhaseStepReconcilerAction) Update(ctx context.Context, o object.MultiPhaseObject, data map[string]any, ...) (res ctrl.Result, err error)
- type BasicReconciler
- type BasicReconcilerAction
- type BasicRemoteDiff
- func (h *BasicRemoteDiff[T]) AddDiff(diff string)
- func (h *BasicRemoteDiff[T]) Diff() string
- func (h *BasicRemoteDiff[T]) GetObjectToCreate() T
- func (h *BasicRemoteDiff[T]) GetObjectToUpdate() T
- func (h *BasicRemoteDiff[T]) IsDiff() bool
- func (h *BasicRemoteDiff[T]) NeedCreate() bool
- func (h *BasicRemoteDiff[T]) NeedUpdate() bool
- func (h *BasicRemoteDiff[T]) SetObjectToCreate(object T)
- func (h *BasicRemoteDiff[T]) SetObjectToUpdate(object T)
- type BasicRemoteExternalReconciler
- type BasicRemoteRead
- type BasicRemoteReconciler
- type BasicRemoteReconcilerAction
- func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Configure(ctx context.Context, o object.RemoteObject, data map[string]any, ...) (res ctrl.Result, err error)
- func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Create(ctx context.Context, o object.RemoteObject, data map[string]any, ...) (res ctrl.Result, err error)
- func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Delete(ctx context.Context, o object.RemoteObject, data map[string]any, ...) (err error)
- func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Diff(ctx context.Context, o object.RemoteObject, read RemoteRead[apiObject], ...) (diff RemoteDiff[apiObject], res ctrl.Result, err error)
- func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) GetIgnoresDiff() []patch.CalculateOption
- func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) GetRemoteHandler(ctx context.Context, req ctrl.Request, o object.RemoteObject) (handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], ...)
- func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) OnError(ctx context.Context, o object.RemoteObject, data map[string]any, ...) (res ctrl.Result, err error)
- func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) OnSuccess(ctx context.Context, o object.RemoteObject, data map[string]any, ...) (res ctrl.Result, err error)
- func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Read(ctx context.Context, o object.RemoteObject, data map[string]any, ...) (read RemoteRead[apiObject], res ctrl.Result, err error)
- func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Update(ctx context.Context, o object.RemoteObject, data map[string]any, ...) (res ctrl.Result, err error)
- type Controller
- type Diff
- type Indexer
- type K8sDiff
- type K8sPhaseReconcilerdeprecated
- type K8sReconcilerdeprecated
- type MultiPhaseDiff
- type MultiPhaseRead
- type MultiPhaseReconciler
- type MultiPhaseReconcilerAction
- type MultiPhaseStepReconciler
- type MultiPhaseStepReconcilerAction
- type Reconcilerdeprecated
- type RemoteDiff
- type RemoteExternalReconciler
- type RemoteRead
- type RemoteReconciler
- type RemoteReconcilerAction
- type StdK8sReconciler
- type StdReconciler
Constants ¶
const ( RunningPhase shared.PhaseName = "running" StartingPhase shared.PhaseName = "starting" ReadyCondition shared.ConditionName = "Ready" BaseAnnotation string = "operator-sdk-extra.webcenter.fr" ShortenError int = 100 )
Variables ¶
var ( ErrWhenCallConfigureFromReconciler = errors.Sentinel("Error when call 'configure' from reconciler") ErrWhenCallReadFromReconciler = errors.Sentinel("Error when call 'read' from reconciler") ErrWhenCallDeleteFromReconciler = errors.Sentinel("Error when call 'delete' from reconciler") ErrWhenCallDiffFromReconciler = errors.Sentinel("Error when call 'diff' from reconciler") ErrWhenCallCreateFromReconciler = errors.Sentinel("Error when call 'create' from reconciler") ErrWhenCallUpdateFromReconciler = errors.Sentinel("Error when call 'update' from reconciler") ErrWhenCallOnSuccessFromReconciler = errors.Sentinel("Error when call 'onSuccess' from reconciler") ErrWhenCallStepReconcilerFromReconciler = errors.Sentinel("Error when call 'reconcile' from step reconciler") ErrWhenGetObjectFromReconciler = errors.Sentinel("Error when get object from reconciler") ErrWhenAddFinalizer = errors.Sentinel("Error when add finalizer") ErrWhenDeleteFinalizer = errors.Sentinel("Error when delete finalizer") ErrWhenGetObjectStatus = errors.Sentinel("Error when get object status") )
Functions ¶
Types ¶
type BaseReconciler ¶ added in v0.1.3
BaseReconciler is the base attributes for all reconciler
type BasicController ¶ added in v0.1.3
type BasicController struct{}
BasicController is the default controller implementation
func (*BasicController) SetupWithManager ¶ added in v0.1.3
func (h *BasicController) SetupWithManager(mgr ctrl.Manager) error
type BasicMultiPhaseDiff ¶ added in v0.1.3
type BasicMultiPhaseDiff struct {
// contains filtered or unexported fields
}
BasicMultiPhaseDiff is the basic implementation of MultiPhaseDiff interface
func (*BasicMultiPhaseDiff) AddDiff ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) AddDiff(diff string)
func (*BasicMultiPhaseDiff) Diff ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) Diff() string
func (*BasicMultiPhaseDiff) GetObjectsToCreate ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) GetObjectsToCreate() []client.Object
func (*BasicMultiPhaseDiff) GetObjectsToDelete ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) GetObjectsToDelete() []client.Object
func (*BasicMultiPhaseDiff) GetObjectsToUpdate ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) GetObjectsToUpdate() []client.Object
func (*BasicMultiPhaseDiff) IsDiff ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) IsDiff() bool
func (*BasicMultiPhaseDiff) NeedCreate ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) NeedCreate() bool
func (*BasicMultiPhaseDiff) NeedDelete ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) NeedDelete() bool
func (*BasicMultiPhaseDiff) NeedUpdate ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) NeedUpdate() bool
func (*BasicMultiPhaseDiff) SetObjectsToCreate ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) SetObjectsToCreate(objects []client.Object)
func (*BasicMultiPhaseDiff) SetObjectsToDelete ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) SetObjectsToDelete(objects []client.Object)
func (*BasicMultiPhaseDiff) SetObjectsToUpdate ¶ added in v0.1.3
func (h *BasicMultiPhaseDiff) SetObjectsToUpdate(objects []client.Object)
type BasicMultiPhaseRead ¶ added in v0.1.3
type BasicMultiPhaseRead struct {
// contains filtered or unexported fields
}
BasicMultiPhaseRead is the basic implementation if MultiPhaseRead
func (*BasicMultiPhaseRead) GetCurrentObjects ¶ added in v0.1.3
func (h *BasicMultiPhaseRead) GetCurrentObjects() []client.Object
func (*BasicMultiPhaseRead) GetExpectedObjects ¶ added in v0.1.3
func (h *BasicMultiPhaseRead) GetExpectedObjects() []client.Object
func (*BasicMultiPhaseRead) SetCurrentObjects ¶ added in v0.1.3
func (h *BasicMultiPhaseRead) SetCurrentObjects(objects []client.Object)
func (*BasicMultiPhaseRead) SetExpectedObjects ¶ added in v0.1.3
func (h *BasicMultiPhaseRead) SetExpectedObjects(objects []client.Object)
type BasicMultiPhaseReconciler ¶ added in v0.1.3
type BasicMultiPhaseReconciler struct {
BasicReconciler
}
BasicMultiPhaseReconciler is the basic multi phase reconsiler you can used whe you should to create multiple k8s resources
func (*BasicMultiPhaseReconciler) Reconcile ¶ added in v0.1.3
func (h *BasicMultiPhaseReconciler) Reconcile(ctx context.Context, req ctrl.Request, o object.MultiPhaseObject, data map[string]interface{}, reconcilerAction MultiPhaseReconcilerAction, reconcilersStepAction ...MultiPhaseStepReconcilerAction) (res ctrl.Result, err error)
type BasicMultiPhaseReconcilerAction ¶ added in v0.1.3
type BasicMultiPhaseReconcilerAction struct {
BasicReconcilerAction
}
BasicMultiPhaseReconcilerAction is the basic implementation of MultiPhaseReconcilerAction interface
func (*BasicMultiPhaseReconcilerAction) Configure ¶ added in v0.1.3
func (h *BasicMultiPhaseReconcilerAction) Configure(ctx context.Context, req ctrl.Request, o object.MultiPhaseObject) (res ctrl.Result, err error)
func (*BasicMultiPhaseReconcilerAction) Delete ¶ added in v0.1.3
func (h *BasicMultiPhaseReconcilerAction) Delete(ctx context.Context, o object.MultiPhaseObject, data map[string]any) (err error)
type BasicMultiPhaseStepReconciler ¶ added in v0.1.3
type BasicMultiPhaseStepReconciler struct {
BaseReconciler
}
BasicMultiPhaseStepReconciler is the basic implementation of MultiPhaseStepReconciler interface
func (*BasicMultiPhaseStepReconciler) Reconcile ¶ added in v0.1.3
func (h *BasicMultiPhaseStepReconciler) Reconcile(ctx context.Context, req ctrl.Request, o object.MultiPhaseObject, data map[string]interface{}, reconcilerAction MultiPhaseStepReconcilerAction, ignoresDiff ...patch.CalculateOption) (res ctrl.Result, err error)
Reconcile permit to reconcile the step (one K8s resource)
type BasicMultiPhaseStepReconcilerAction ¶ added in v0.1.3
type BasicMultiPhaseStepReconcilerAction struct { BasicReconcilerAction // contains filtered or unexported fields }
BasicMultiPhaseStepReconcilerAction is the basic implementation of MultiPhaseStepReconcilerAction
func (*BasicMultiPhaseStepReconcilerAction) Configure ¶ added in v0.1.3
func (h *BasicMultiPhaseStepReconcilerAction) Configure(ctx context.Context, req ctrl.Request, o object.MultiPhaseObject) (res ctrl.Result, err error)
func (*BasicMultiPhaseStepReconcilerAction) Diff ¶ added in v0.1.3
func (h *BasicMultiPhaseStepReconcilerAction) Diff(ctx context.Context, o object.MultiPhaseObject, read MultiPhaseRead, data map[string]any, ignoreDiff ...patch.CalculateOption) (diff MultiPhaseDiff, res ctrl.Result, err error)
func (*BasicMultiPhaseStepReconcilerAction) GetIgnoresDiff ¶ added in v0.1.3
func (h *BasicMultiPhaseStepReconcilerAction) GetIgnoresDiff() []patch.CalculateOption
func (*BasicMultiPhaseStepReconcilerAction) GetPhaseName ¶ added in v0.1.3
func (h *BasicMultiPhaseStepReconcilerAction) GetPhaseName() shared.PhaseName
func (*BasicMultiPhaseStepReconcilerAction) OnSuccess ¶ added in v0.1.3
func (h *BasicMultiPhaseStepReconcilerAction) OnSuccess(ctx context.Context, o object.MultiPhaseObject, data map[string]any, diff MultiPhaseDiff) (res ctrl.Result, err error)
func (*BasicMultiPhaseStepReconcilerAction) Read ¶ added in v0.1.3
func (h *BasicMultiPhaseStepReconcilerAction) Read(ctx context.Context, o object.MultiPhaseObject, data map[string]any) (read MultiPhaseRead, res ctrl.Result, err error)
type BasicReconciler ¶ added in v0.1.3
type BasicReconciler struct { BaseReconciler // contains filtered or unexported fields }
BasicReconciler is the basic implementation of BaseReconciler It also provide attributes needed by all reconciler
type BasicReconcilerAction ¶ added in v0.1.3
type BasicReconcilerAction struct { BaseReconciler // contains filtered or unexported fields }
BasicReconcilerAction provide attribute needed by all reconciler action
type BasicRemoteDiff ¶ added in v0.1.3
type BasicRemoteDiff[T any] struct { // contains filtered or unexported fields }
BasicRemoteDiff is the basic implementation of RemoteDiff interface
func (*BasicRemoteDiff[T]) AddDiff ¶ added in v0.1.3
func (h *BasicRemoteDiff[T]) AddDiff(diff string)
func (*BasicRemoteDiff[T]) Diff ¶ added in v0.1.3
func (h *BasicRemoteDiff[T]) Diff() string
func (*BasicRemoteDiff[T]) GetObjectToCreate ¶ added in v0.1.3
func (h *BasicRemoteDiff[T]) GetObjectToCreate() T
func (*BasicRemoteDiff[T]) GetObjectToUpdate ¶ added in v0.1.3
func (h *BasicRemoteDiff[T]) GetObjectToUpdate() T
func (*BasicRemoteDiff[T]) IsDiff ¶ added in v0.1.3
func (h *BasicRemoteDiff[T]) IsDiff() bool
func (*BasicRemoteDiff[T]) NeedCreate ¶ added in v0.1.3
func (h *BasicRemoteDiff[T]) NeedCreate() bool
func (*BasicRemoteDiff[T]) NeedUpdate ¶ added in v0.1.3
func (h *BasicRemoteDiff[T]) NeedUpdate() bool
func (*BasicRemoteDiff[T]) SetObjectToCreate ¶ added in v0.1.3
func (h *BasicRemoteDiff[T]) SetObjectToCreate(object T)
func (*BasicRemoteDiff[T]) SetObjectToUpdate ¶ added in v0.1.3
func (h *BasicRemoteDiff[T]) SetObjectToUpdate(object T)
type BasicRemoteExternalReconciler ¶ added in v0.1.3
type BasicRemoteExternalReconciler[k8sObject comparable, apiObject comparable, apiClient any] struct { // contains filtered or unexported fields }
BasicRemoteExternalReconciler is the basic implementation of RemoteExternalReconciler It only implement the Diff method, because of is generic with 3-way merge patch
func NewBasicRemoteExternalReconciler ¶ added in v0.1.3
func NewBasicRemoteExternalReconciler[k8sObject comparable, apiObject comparable, apiClient any](handler apiClient) *BasicRemoteExternalReconciler[k8sObject, apiObject, apiClient]
func (*BasicRemoteExternalReconciler[k8sObject, apiObject, apiClient]) Client ¶ added in v0.1.3
func (h *BasicRemoteExternalReconciler[k8sObject, apiObject, apiClient]) Client() apiClient
func (*BasicRemoteExternalReconciler[k8sObject, apiObject, apiClient]) Diff ¶ added in v0.1.3
func (h *BasicRemoteExternalReconciler[k8sObject, apiObject, apiClient]) Diff(currentOject apiObject, expectedObject apiObject, originalObject apiObject, ignoresDiff ...patch.CalculateOption) (patchResult *patch.PatchResult, err error)
type BasicRemoteRead ¶ added in v0.1.3
type BasicRemoteRead[T any] struct { // contains filtered or unexported fields }
BasicMultiPhaseRead is the basic implementation if MultiPhaseRead
func (*BasicRemoteRead[T]) GetCurrentObject ¶ added in v0.1.3
func (h *BasicRemoteRead[T]) GetCurrentObject() T
func (*BasicRemoteRead[T]) GetExpectedObject ¶ added in v0.1.3
func (h *BasicRemoteRead[T]) GetExpectedObject() T
func (*BasicRemoteRead[T]) SetCurrentObject ¶ added in v0.1.3
func (h *BasicRemoteRead[T]) SetCurrentObject(object T)
func (*BasicRemoteRead[T]) SetExpectedObject ¶ added in v0.1.3
func (h *BasicRemoteRead[T]) SetExpectedObject(object T)
type BasicRemoteReconciler ¶ added in v0.1.3
type BasicRemoteReconciler[k8sObject comparable, apiObject comparable, apiClient any] struct { BasicReconciler }
BasicRemoteReconciler is the basic implementation of RemoteReconciler interface
func (*BasicRemoteReconciler[k8sObject, apiObject, apiClient]) Reconcile ¶ added in v0.1.3
func (h *BasicRemoteReconciler[k8sObject, apiObject, apiClient]) Reconcile(ctx context.Context, req ctrl.Request, o object.RemoteObject, data map[string]interface{}, reconciler RemoteReconcilerAction[k8sObject, apiObject, apiClient]) (res ctrl.Result, err error)
type BasicRemoteReconcilerAction ¶ added in v0.1.3
type BasicRemoteReconcilerAction[k8sObject comparable, apiObject comparable, apiClient any] struct { BasicReconcilerAction }
BasicRemoteReconcilerAction is the basic implementation of RemoteReconcilerAction
func (*BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Configure ¶ added in v0.1.3
func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Configure(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient]) (res ctrl.Result, err error)
func (*BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Create ¶ added in v0.1.3
func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Create(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], object apiObject) (res ctrl.Result, err error)
func (*BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Delete ¶ added in v0.1.3
func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Delete(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient]) (err error)
Delete can be call on your own version It only add some log / events
func (*BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Diff ¶ added in v0.1.3
func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Diff(ctx context.Context, o object.RemoteObject, read RemoteRead[apiObject], data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], ignoreDiff ...patch.CalculateOption) (diff RemoteDiff[apiObject], res ctrl.Result, err error)
func (*BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) GetIgnoresDiff ¶ added in v0.1.3
func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) GetIgnoresDiff() []patch.CalculateOption
func (*BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) GetRemoteHandler ¶ added in v0.1.3
func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) GetRemoteHandler(ctx context.Context, req ctrl.Request, o object.RemoteObject) (handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], res ctrl.Result, err error)
func (*BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) OnError ¶ added in v0.1.3
func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) OnError(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], currentErr error) (res ctrl.Result, err error)
func (*BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) OnSuccess ¶ added in v0.1.3
func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) OnSuccess(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], diff RemoteDiff[apiObject]) (res ctrl.Result, err error)
func (*BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Read ¶ added in v0.1.3
func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Read(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient]) (read RemoteRead[apiObject], res ctrl.Result, err error)
func (*BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Update ¶ added in v0.1.3
func (h *BasicRemoteReconcilerAction[k8sObject, apiObject, apiClient]) Update(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], object apiObject) (res ctrl.Result, err error)
Update can be call on your own version It only add some log / events
type Controller ¶ added in v0.1.3
type Controller interface { Reconcile(context.Context, reconcile.Request) (reconcile.Result, error) // SetupWithManager permit to setup controller with manager SetupWithManager(mgr ctrl.Manager) error }
Controller is the controller interface
func NewBasicController ¶ added in v0.1.3
func NewBasicController() Controller
NewBasicController is the default constructor for Controller index can be nil
type K8sPhaseReconciler
deprecated
added in
v0.1.0
type K8sPhaseReconciler interface { // Configure permit to init condition on status Configure(ctx context.Context, req ctrl.Request, resource client.Object) (res ctrl.Result, err error) // Read permit to read kubernetes resources Read(ctx context.Context, r client.Object, data map[string]any) (res ctrl.Result, err error) // Create permit to create resources on kubernetes Create(ctx context.Context, r client.Object, data map[string]any) (res ctrl.Result, err error) // Update permit to update resources on kubernetes Update(ctx context.Context, r client.Object, data map[string]any) (res ctrl.Result, err error) // Delete permit to delete resources on kubernetes Delete(ctx context.Context, r client.Object, data map[string]any) (res ctrl.Result, err error) // OnError is call when error is throwing on current phase // It the right way to set status condition when error OnError(ctx context.Context, r client.Object, data map[string]any, currentErr error) (res ctrl.Result, err error) // OnSuccess is call at the end of current phase, if not error // It's the right way to set status condition when everithink is good OnSuccess(ctx context.Context, r client.Object, data map[string]any, diff K8sDiff) (res ctrl.Result, err error) // Diff permit to compare the actual state and the expected state Diff(ctx context.Context, r client.Object, data map[string]any) (diff K8sDiff, res ctrl.Result, err error) // GetName return the reconciler name GetName() string }
Deprecated: use MultiPhaseStepReconcilerAction instead
type K8sReconciler
deprecated
added in
v0.1.0
type K8sReconciler interface { // Configure permit to init condition on status Configure(ctx context.Context, req ctrl.Request, resource client.Object) (res ctrl.Result, err error) // Read permit to read kubernetes resources Read(ctx context.Context, r client.Object, data map[string]any) (res ctrl.Result, err error) // Delete permit to delete resources on kubernetes Delete(ctx context.Context, r client.Object, data map[string]any) (err error) // OnError is call when error is throwing on current phase // It the right way to set status condition when error OnError(ctx context.Context, r client.Object, data map[string]any, currentErr error) (res ctrl.Result, err error) // OnSuccess is call at the end of current phase, if not error // It's the right way to set status condition when everithink is good OnSuccess(ctx context.Context, r client.Object, data map[string]any) (res ctrl.Result, err error) }
Deprecated: use MultiPhaseReconcilerAction instead
type MultiPhaseDiff ¶ added in v0.1.3
type MultiPhaseDiff interface { // NeedCreate is true when need to create K8s object NeedCreate() bool // NeedUpdate is true when need to update K8s object NeedUpdate() bool // NeedDelete is true when need to delete K8s object NeedDelete() bool // GetObjectsToCreate is the list of object to create on K8s GetObjectsToCreate() []client.Object // SetObjectsToCreate permit to set the list of object to create on K8s SetObjectsToCreate(objects []client.Object) // GetObjectsToUpdate is the list of object to update on K8s GetObjectsToUpdate() []client.Object // SetObjectsToUpdate permit to set the list of object to update on K8s SetObjectsToUpdate(objects []client.Object) // GetObjectsToDelete is the list of Object to delete on K8s GetObjectsToDelete() []client.Object // SetObjectsToDelete permit to set the list of object to delete SetObjectsToDelete(objects []client.Object) // AddDiff permit to add diff // It add return line at the end AddDiff(diff string) // Diff permit to print human diff Diff() string // IsDiff permit to know is there are current diff to print IsDiff() bool }
MultiPhaseDiff is used to know if currents resources differ with expected
func NewBasicMultiPhaseDiff ¶ added in v0.1.3
func NewBasicMultiPhaseDiff() MultiPhaseDiff
NewBasicMultiPhaseDiff is the basic contructor of MultiPhaseDiff interface
type MultiPhaseRead ¶ added in v0.1.3
type MultiPhaseRead interface { // GetCurrentObjects permit to get the list of current objects GetCurrentObjects() []client.Object // SetCurrentObjects permit to set the list of current objects SetCurrentObjects(objects []client.Object) // GetExpectedObjects permit to get the list of expected objects GetExpectedObjects() []client.Object // SetExpectedObjects permit to set the list of expected objects SetExpectedObjects(objects []client.Object) }
MultiPhaseRead is the interface to store the result of read step on multi phase reconciler
func NewBasicMultiPhaseRead ¶ added in v0.1.3
func NewBasicMultiPhaseRead() MultiPhaseRead
NewBasicMultiPhaseRead is the basic constructor of MultiPhaseRead interface
type MultiPhaseReconciler ¶ added in v0.1.3
type MultiPhaseReconciler interface { // Reconcile permit to orchestrate all phase needed to successfully reconcile the object Reconcile(ctx context.Context, req ctrl.Request, o object.MultiPhaseObject, data map[string]interface{}, reconciler MultiPhaseReconcilerAction, reconcilersStep ...MultiPhaseStepReconcilerAction) (res ctrl.Result, err error) }
MultiPhaseReconciler the reconciler to implement whe you need to create multiple resources on k8s
func NewBasicMultiPhaseReconciler ¶ added in v0.1.3
func NewBasicMultiPhaseReconciler(client client.Client, name string, finalizer shared.FinalizerName, logger *logrus.Entry, recorder record.EventRecorder) (multiPhaseReconciler MultiPhaseReconciler)
NewBasicMultiPhaseReconciler permit to instanciate new basic multiphase resonciler
type MultiPhaseReconcilerAction ¶ added in v0.1.3
type MultiPhaseReconcilerAction interface { // Configure permit to init condition on status Configure(ctx context.Context, req ctrl.Request, o object.MultiPhaseObject) (res ctrl.Result, err error) // Read permit to read kubernetes resources Read(ctx context.Context, o object.MultiPhaseObject, data map[string]any) (res ctrl.Result, err error) // Delete permit to delete resources on kubernetes Delete(ctx context.Context, o object.MultiPhaseObject, data map[string]any) (err error) // OnError is call when error is throwing on current phase // It the right way to set status condition when error OnError(ctx context.Context, o object.MultiPhaseObject, data map[string]any, currentErr error) (res ctrl.Result, err error) // OnSuccess is call at the end of current phase, if not error // It's the right way to set status condition when everithink is good OnSuccess(ctx context.Context, o object.MultiPhaseObject, data map[string]any) (res ctrl.Result, err error) }
MultiPhaseReconcilerAction is the methode needed by step reconciler to reconcile your custom resource
func NewBasicMultiPhaseReconcilerAction ¶ added in v0.1.3
func NewBasicMultiPhaseReconcilerAction(client client.Client, conditionName shared.ConditionName, logger *logrus.Entry, recorder record.EventRecorder) (multiPhaseReconciler MultiPhaseReconcilerAction)
NewBasicMultiPhaseReconcilerAction is the basic contructor of MultiPhaseReconcilerAction interface
type MultiPhaseStepReconciler ¶ added in v0.1.3
type MultiPhaseStepReconciler interface { // Reconcile permit to reconcile the step (one K8s resource) Reconcile(ctx context.Context, req ctrl.Request, o object.MultiPhaseObject, data map[string]interface{}, reconciler MultiPhaseStepReconcilerAction, ignoresDiff ...patch.CalculateOption) (res ctrl.Result, err error) }
MultiPhaseStepReconciler is the reconciler to implement to create one step for MultiPhaseReconciler
func NewBasicMultiPhaseStepReconciler ¶ added in v0.1.3
func NewBasicMultiPhaseStepReconciler(client client.Client, logger *logrus.Entry, recorder record.EventRecorder) (multiPhaseStepReconciler MultiPhaseStepReconciler)
NewBasicMultiPhaseStepReconciler is the basic constructor of MultiPhaseStepReconciler interface
type MultiPhaseStepReconcilerAction ¶ added in v0.1.3
type MultiPhaseStepReconcilerAction interface { // Configure permit to init condition on status Configure(ctx context.Context, req ctrl.Request, o object.MultiPhaseObject) (res ctrl.Result, err error) // Read permit to read kubernetes resources Read(ctx context.Context, o object.MultiPhaseObject, data map[string]any) (read MultiPhaseRead, res ctrl.Result, err error) // Create permit to create resources on kubernetes Create(ctx context.Context, o object.MultiPhaseObject, data map[string]any, objects []client.Object) (res ctrl.Result, err error) // Update permit to update resources on kubernetes Update(ctx context.Context, o object.MultiPhaseObject, data map[string]any, objects []client.Object) (res ctrl.Result, err error) // Delete permit to delete resources on kubernetes Delete(ctx context.Context, o object.MultiPhaseObject, data map[string]any, objects []client.Object) (res ctrl.Result, err error) // OnError is call when error is throwing on current phase // It the right way to set status condition when error OnError(ctx context.Context, o object.MultiPhaseObject, data map[string]any, currentErr error) (res ctrl.Result, err error) // OnSuccess is call at the end of current phase, if not error // It's the right way to set status condition when everithink is good OnSuccess(ctx context.Context, o object.MultiPhaseObject, data map[string]any, diff MultiPhaseDiff) (res ctrl.Result, err error) // Diff permit to compare the actual state and the expected state Diff(ctx context.Context, o object.MultiPhaseObject, read MultiPhaseRead, data map[string]any, ignoreDiff ...patch.CalculateOption) (diff MultiPhaseDiff, res ctrl.Result, err error) // GetPhaseName permit to get the phase name GetPhaseName() shared.PhaseName GetIgnoresDiff() []patch.CalculateOption }
MultiPhaseStepReconcilerAction is the interface that use by reconciler step to reconcile your intermediate K8s resources
func NewBasicMultiPhaseStepReconcilerAction ¶ added in v0.1.3
func NewBasicMultiPhaseStepReconcilerAction(client client.Client, phaseName shared.PhaseName, conditionName shared.ConditionName, logger *logrus.Entry, recorder record.EventRecorder) (multiPhaseStepReconciler MultiPhaseStepReconcilerAction)
NewBasicMultiPhaseStepReconcilerAction is the basic constructor of MultiPhaseStepReconcilerAction interface
type Reconciler
deprecated
type Reconciler interface { // Confirgure permit to init external provider driver (API client REST) // It can also permit to init condition on status Configure(ctx context.Context, req ctrl.Request, resource client.Object) (meta any, err error) // Read permit to read the actual resource state from provider and set it on data map Read(ctx context.Context, r client.Object, data map[string]any, meta any) (res ctrl.Result, err error) // Create permit to create resource on provider // It only call if diff.NeeCreated is true Create(ctx context.Context, r client.Object, data map[string]any, meta any) (res ctrl.Result, err error) // Update permit to update resource on provider // It only call if diff.NeedUpdated is true Update(ctx context.Context, r client.Object, data map[string]any, meta any) (res ctrl.Result, err error) // Delete permit to delete resource on provider // It only call if you have specified finalizer name when you create reconciler and if resource as marked to be deleted Delete(ctx context.Context, r client.Object, data map[string]any, meta any) (err error) // OnError is call when error is throwing // It the right way to set status condition when error OnError(ctx context.Context, r client.Object, data map[string]any, meta any, err error) // OnSuccess is call at the end if no error // It's the right way to set status condition when everithink is good OnSuccess(ctx context.Context, r client.Object, data map[string]any, meta any, diff Diff) (err error) // Diff permit to compare the actual state and the expected state Diff(r client.Object, data map[string]any, meta any) (diff Diff, err error) }
Deprecated: Use RemoteReconcilerAction instead
type RemoteDiff ¶ added in v0.1.3
type RemoteDiff[T any] interface { // NeedCreate is true when need to create K8s object NeedCreate() bool // NeedUpdate is true when need to update K8s object NeedUpdate() bool // GetObjectsToCreate is the list of object to create on K8s GetObjectToCreate() T // SetObjectsToCreate permit to set the list of object to create on K8s SetObjectToCreate(object T) // GetObjectsToUpdate is the list of object to update on K8s GetObjectToUpdate() T // SetObjectsToUpdate permit to set the list of object to update on K8s SetObjectToUpdate(object T) // AddDiff permit to add diff // It add return line at the end AddDiff(diff string) // Diff permit to print human diff Diff() string // IsDiff permit to know is there are current diff to print IsDiff() bool }
func NewBasicRemoteDiff ¶ added in v0.1.3
func NewBasicRemoteDiff[T any]() RemoteDiff[T]
NewBasicRemoteDiff is the basic contructor of RemoteDiff interface
type RemoteExternalReconciler ¶ added in v0.1.3
type RemoteExternalReconciler[k8sObject comparable, apiObject comparable, apiClient any] interface { Build(k8sO k8sObject) (object apiObject, err error) Get(k8sO k8sObject) (object apiObject, err error) Create(apiO apiObject, k8sO k8sObject) (err error) Update(apiO apiObject, k8sO k8sObject) (err error) Delete(k8sO k8sObject) (err error) Diff(currentOject apiObject, expectedObject apiObject, originalObject apiObject, ignoresDiff ...patch.CalculateOption) (patchResult *patch.PatchResult, err error) Client() apiClient }
RemoteExternalReconciler is the interface to call the remote API to handler resource
type RemoteRead ¶ added in v0.1.3
type RemoteRead[T any] interface { // GetCurrentObject permit to get the current object GetCurrentObject() T // SetCurrentObject permit to set the current object SetCurrentObject(object T) // GetExpectedObject permit to get the expected object GetExpectedObject() T // SetExpectedObject permit to set the expected object SetExpectedObject(object T) }
RemoteRead is the interface to store the result of read on remote reconciler
func NewBasicRemoteRead ¶ added in v0.1.3
func NewBasicRemoteRead[T any]() RemoteRead[T]
NewBasicRemoteRead is the basic constructor of RemoteRead interface
type RemoteReconciler ¶ added in v0.1.3
type RemoteReconciler[k8sObject comparable, apiObject comparable, apiClient any] interface { // Reconcile permit to reconcile the step (one K8s resource) Reconcile(ctx context.Context, req ctrl.Request, o object.RemoteObject, data map[string]interface{}, reconciler RemoteReconcilerAction[k8sObject, apiObject, apiClient]) (res ctrl.Result, err error) }
RemoteReconciler is the reconciler to reconcile the remote resource
func NewBasicRemoteReconciler ¶ added in v0.1.3
func NewBasicRemoteReconciler[k8sObject comparable, apiObject comparable, apiClient any](client client.Client, name string, finalizer shared.FinalizerName, logger *logrus.Entry, recorder record.EventRecorder) (remoteReconciler RemoteReconciler[k8sObject, apiObject, apiClient])
NewBasicMultiPhaseReconciler permit to instanciate new basic multiphase resonciler
type RemoteReconcilerAction ¶ added in v0.1.3
type RemoteReconcilerAction[k8sObject comparable, apiObject comparable, apiClient any] interface { // GetRemoteHandler permit to get the handler to manage the remote resources GetRemoteHandler(ctx context.Context, req ctrl.Request, o object.RemoteObject) (handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], res ctrl.Result, err error) // Confirgure permit to init external provider driver (API client REST) // It can also permit to init condition on status Configure(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient]) (res ctrl.Result, err error) // Read permit to read the actual resource state from provider and set it on data map Read(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient]) (read RemoteRead[apiObject], res ctrl.Result, err error) // Create permit to create resource on provider // It only call if diff.NeeCreated is true Create(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], object apiObject) (res ctrl.Result, err error) // Update permit to update resource on provider // It only call if diff.NeedUpdated is true Update(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], object apiObject) (res ctrl.Result, err error) // Delete permit to delete resource on provider // It only call if you have specified finalizer name when you create reconciler and if resource as marked to be deleted Delete(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient]) (err error) // OnError is call when error is throwing // It the right way to set status condition when error OnError(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], currentErr error) (res ctrl.Result, err error) // OnSuccess is call at the end if no error // It's the right way to set status condition when everithink is good OnSuccess(ctx context.Context, o object.RemoteObject, data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], diff RemoteDiff[apiObject]) (res ctrl.Result, err error) // Diff permit to compare the actual state and the expected state Diff(ctx context.Context, o object.RemoteObject, read RemoteRead[apiObject], data map[string]any, handler RemoteExternalReconciler[k8sObject, apiObject, apiClient], ignoreDiff ...patch.CalculateOption) (diff RemoteDiff[apiObject], res ctrl.Result, err error) GetIgnoresDiff() []patch.CalculateOption }
RemoteReconcilerAction is the interface that use by reconciler remote to reconcile your remote resource
func NewRemoteReconcilerAction ¶ added in v0.1.3
func NewRemoteReconcilerAction[k8sObject comparable, apiObject comparable, apiClient any](client client.Client, logger *logrus.Entry, recorder record.EventRecorder) (remoteReconciler RemoteReconcilerAction[k8sObject, apiObject, apiClient])
NewRemoteReconcilerAction is the basic constructor of RemoteReconcilerAction interface
type StdK8sReconciler ¶ added in v0.1.0
func NewStdK8sReconciler ¶ added in v0.1.0
func NewStdK8sReconciler(client client.Client, finalizer string, reconciler K8sReconciler, logger *logrus.Entry, recorder record.EventRecorder) (stdK8sReconciler *StdK8sReconciler, err error)
func (*StdK8sReconciler) Reconcile ¶ added in v0.1.0
func (h *StdK8sReconciler) Reconcile(ctx context.Context, req ctrl.Request, r client.Object, data map[string]interface{}, reconcilers ...K8sPhaseReconciler) (res ctrl.Result, err error)
ReconcileK8sResources permit to reconcile kubernetes resources, so the step is not the same on Reconcile. When handle kubernetes resources, you should to chain the reconcile on multiple resources It will run on following steps 1. Read the main object 2. Configure finalizer on the main object 3. Execute each phase that concist of: 3.1 Read kubernetes objects 3.2 Diff kubernetes resources with expected resources 3.3 Update / create resources if needed 3.4 Delete resources if needed 4. Delete finalizer if on delete action Deprecated: Use MultiPhaseReconciler instead
type StdReconciler ¶
func NewStdReconciler ¶
func NewStdReconciler(client client.Client, finalizer string, reconciler Reconciler, logger *logrus.Entry, recorder record.EventRecorder) (stdReconciler *StdReconciler, err error)
func (*StdReconciler) Reconcile ¶
func (h *StdReconciler) Reconcile(ctx context.Context, req ctrl.Request, r client.Object, data map[string]interface{}) (res ctrl.Result, err error)
Reconcile permit to reconcile resource one external service, throughtout API It will handle all aspect of that 1. Read resource on kubernetes 2. Configure finalizer 3. Read external resources 4. Check if on delete phase, delete external resources if on it 5. Diff external resources with the expected resources 6. Create or update external resources if needed Deprecated: Use RemoteReconciler instead
Source Files
¶
- common.go
- controller.go
- external_reconciler.go
- k8s_reconciler.go
- multiphase_action.go
- multiphase_diff.go
- multiphase_read.go
- multiphase_reconciler.go
- multiphasestep_action.go
- multiphasestep_reconciler.go
- reconciler.go
- remote_action.go
- remote_diff.go
- remote_external_reconciler.go
- remote_read.go
- remote_reconciler.go