Documentation ¶
Index ¶
- func AddFinalizer(obj client.Object, finalizer string)
- func HasFinalizer(obj client.Object, finalizer string) bool
- func IsBeingDeleted(obj client.Object) bool
- func IsOwner(owner, owned metav1.Object) bool
- func RemoveFinalizer(obj client.Object, finalizer string)
- type ReconcilerBase
- func (r *ReconcilerBase) CreateIfNotExistTemplatedResources(context context.Context, owner client.Object, namespace string, ...) error
- func (r *ReconcilerBase) CreateOrUpdateResource(context context.Context, owner client.Object, namespace string, ...) error
- func (r *ReconcilerBase) CreateOrUpdateResources(context context.Context, owner client.Object, namespace string, ...) error
- func (r *ReconcilerBase) CreateOrUpdateTemplatedResources(context context.Context, owner client.Object, namespace string, ...) error
- func (r *ReconcilerBase) CreateOrUpdateUnstructuredResources(context context.Context, owner client.Object, namespace string, ...) error
- func (r *ReconcilerBase) CreateResourceIfNotExists(context context.Context, owner client.Object, namespace string, ...) error
- func (r *ReconcilerBase) CreateResourcesIfNotExist(context context.Context, owner client.Object, namespace string, ...) error
- func (r *ReconcilerBase) CreateUnstructuredResourcesIfNotExist(context context.Context, owner client.Object, namespace string, ...) error
- func (r *ReconcilerBase) DeleteResourceIfExists(context context.Context, obj client.Object) error
- func (r *ReconcilerBase) DeleteResourcesIfExist(context context.Context, objs []client.Object) error
- func (r *ReconcilerBase) DeleteTemplatedResources(context context.Context, data interface{}, template *template.Template) error
- func (r *ReconcilerBase) DeleteUnstructuredResources(context context.Context, objs []unstructured.Unstructured) error
- func (r *ReconcilerBase) GetAPIReader() client.Reader
- func (r *ReconcilerBase) GetClient() client.Client
- func (r *ReconcilerBase) GetDirectClient() (client.Client, error)
- func (r *ReconcilerBase) GetDirectClientWithSchemeBuilders(addToSchemes ...func(s *runtime.Scheme) error) (client.Client, error)
- func (r *ReconcilerBase) GetDiscoveryClient() (*discovery.DiscoveryClient, error)
- func (r *ReconcilerBase) GetOperatorNamespace() (string, error)
- func (r *ReconcilerBase) GetRecorder() record.EventRecorder
- func (r *ReconcilerBase) GetRestConfig() *rest.Config
- func (r *ReconcilerBase) GetScheme() *runtime.Scheme
- func (r *ReconcilerBase) IsInitialized(obj metav1.Object) bool
- func (r *ReconcilerBase) IsValid(obj metav1.Object) (bool, error)
- func (r *ReconcilerBase) ManageError(context context.Context, obj client.Object, issue error) (reconcile.Result, error)
- func (r *ReconcilerBase) ManageErrorWithRequeue(context context.Context, obj client.Object, issue error, ...) (reconcile.Result, error)
- func (r *ReconcilerBase) ManageOutcomeWithRequeue(context context.Context, obj client.Object, issue error, ...) (reconcile.Result, error)
- func (r *ReconcilerBase) ManageSuccess(context context.Context, obj client.Object) (reconcile.Result, error)
- func (r *ReconcilerBase) ManageSuccessWithRequeue(context context.Context, obj client.Object, requeueAfter time.Duration) (reconcile.Result, error)
- func (r *ReconcilerBase) Reconcile(request reconcile.Request) (reconcile.Result, error)
- type ResourceGenerationOrFinalizerChangedPredicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFinalizer ¶
AddFinalizer adds the passed finalizer this object Deprecated use controllerutil.AddFinalizer
func HasFinalizer ¶
HasFinalizer returns whether this object has the passed finalizer Deprecated use controllerutil.ContainsFinalizer
func IsBeingDeleted ¶
IsBeingDeleted returns whether this object has been requested to be deleted
func RemoveFinalizer ¶
RemoveFinalizer removes the passed finalizer from object Deprecated use controllerutil.RemoveFinalizer
Types ¶
type ReconcilerBase ¶
type ReconcilerBase struct {
// contains filtered or unexported fields
}
ReconcilerBase is a base struct from which all reconcilers can be derived from. By doing so your reconcilers will also inherit a set of utility functions To inherit from reconciler just build your finalizer this way:
type MyReconciler struct { util.ReconcilerBase ... other optional fields ... }
func NewFromManager ¶ added in v1.1.1
func NewFromManager(mgr manager.Manager, recorder record.EventRecorder) ReconcilerBase
NewReconcilerBase is a contruction function to create a new ReconcilerBase.
func NewReconcilerBase ¶
func (*ReconcilerBase) CreateIfNotExistTemplatedResources ¶
func (r *ReconcilerBase) CreateIfNotExistTemplatedResources(context context.Context, owner client.Object, namespace string, data interface{}, template *template.Template) error
CreateIfNotExistTemplatedResources processes an initialized template expecting an array of objects as a result and then processes them with the CreateResourceIfNotExists function
func (*ReconcilerBase) CreateOrUpdateResource ¶
func (r *ReconcilerBase) CreateOrUpdateResource(context context.Context, owner client.Object, namespace string, obj client.Object) error
CreateOrUpdateResource creates a resource if it doesn't exist, and updates (overwrites it), if it exist if owner is not nil, the owner field os set if namespace is not "", the namespace field of the object is overwritten with the passed value
func (*ReconcilerBase) CreateOrUpdateResources ¶
func (r *ReconcilerBase) CreateOrUpdateResources(context context.Context, owner client.Object, namespace string, objs []client.Object) error
CreateOrUpdateResources operates as CreateOrUpdate, but on an array of resources
func (*ReconcilerBase) CreateOrUpdateTemplatedResources ¶
func (r *ReconcilerBase) CreateOrUpdateTemplatedResources(context context.Context, owner client.Object, namespace string, data interface{}, template *template.Template) error
CreateOrUpdateTemplatedResources processes an initialized template expecting an array of objects as a result and the processes them with the CreateOrUpdate function
func (*ReconcilerBase) CreateOrUpdateUnstructuredResources ¶ added in v0.2.0
func (r *ReconcilerBase) CreateOrUpdateUnstructuredResources(context context.Context, owner client.Object, namespace string, objs []unstructured.Unstructured) error
CreateOrUpdateUnstructuredResources operates as CreateOrUpdate, but on an array of unstructured.Unstructured
func (*ReconcilerBase) CreateResourceIfNotExists ¶
func (r *ReconcilerBase) CreateResourceIfNotExists(context context.Context, owner client.Object, namespace string, obj client.Object) error
CreateResourceIfNotExists create a resource if it doesn't already exists. If the resource exists it is left untouched and the functin does not fails if owner is not nil, the owner field os set if namespace is not "", the namespace field of the object is overwritten with the passed value
func (*ReconcilerBase) CreateResourcesIfNotExist ¶
func (r *ReconcilerBase) CreateResourcesIfNotExist(context context.Context, owner client.Object, namespace string, objs []client.Object) error
CreateResourcesIfNotExist operates as CreateResourceIfNotExists, but on an array of resources
func (*ReconcilerBase) CreateUnstructuredResourcesIfNotExist ¶ added in v0.2.0
func (r *ReconcilerBase) CreateUnstructuredResourcesIfNotExist(context context.Context, owner client.Object, namespace string, objs []unstructured.Unstructured) error
CreateUnstructuredResourcesIfNotExist operates as CreateResourceIfNotExists, but on an array of unstructured.Unstructured
func (*ReconcilerBase) DeleteResourceIfExists ¶ added in v0.2.0
DeleteResourceIfExists deletes an existing resource. It doesn't fail if the resource does not exist
func (*ReconcilerBase) DeleteResourcesIfExist ¶ added in v0.2.0
func (r *ReconcilerBase) DeleteResourcesIfExist(context context.Context, objs []client.Object) error
DeleteResourcesIfExist operates like DeleteResources, but on an arrays of resources
func (*ReconcilerBase) DeleteTemplatedResources ¶
func (r *ReconcilerBase) DeleteTemplatedResources(context context.Context, data interface{}, template *template.Template) error
DeleteTemplatedResources processes an initialized template expecting an array of objects as a result and then processes them with the Delete function
func (*ReconcilerBase) DeleteUnstructuredResources ¶ added in v0.2.0
func (r *ReconcilerBase) DeleteUnstructuredResources(context context.Context, objs []unstructured.Unstructured) error
DeleteUnstructuredResources operates like DeleteResources, but on an arrays of unstructured.Unstructured
func (*ReconcilerBase) GetAPIReader ¶ added in v1.1.0
func (r *ReconcilerBase) GetAPIReader() client.Reader
GetAPIReader returns a non cached reader
func (*ReconcilerBase) GetClient ¶
func (r *ReconcilerBase) GetClient() client.Client
GetClient returns the underlying client
func (*ReconcilerBase) GetDirectClient ¶ added in v1.1.0
func (r *ReconcilerBase) GetDirectClient() (client.Client, error)
GetDirectClient returns a non cached client
func (*ReconcilerBase) GetDirectClientWithSchemeBuilders ¶ added in v1.1.0
func (r *ReconcilerBase) GetDirectClientWithSchemeBuilders(addToSchemes ...func(s *runtime.Scheme) error) (client.Client, error)
GetDirectClientWithSchemeBuilders returns a non cached client initialized with the scheme.buidlers passed as parameters
func (*ReconcilerBase) GetDiscoveryClient ¶
func (r *ReconcilerBase) GetDiscoveryClient() (*discovery.DiscoveryClient, error)
GetDiscoveryClient returns a discovery client for the current reconciler
func (*ReconcilerBase) GetOperatorNamespace ¶ added in v1.1.0
func (r *ReconcilerBase) GetOperatorNamespace() (string, error)
GetOperatorNamespace tries to infer the operator namespace. I first looks for the /var/run/secrets/kubernetes.io/serviceaccount/namespace file. Then it looks for a NAMESPACE environment variable (useful when running in local mode).
func (*ReconcilerBase) GetRecorder ¶
func (r *ReconcilerBase) GetRecorder() record.EventRecorder
GetRecorder returns the underlying recorder
func (*ReconcilerBase) GetRestConfig ¶
func (r *ReconcilerBase) GetRestConfig() *rest.Config
GetRestConfig returns the undelying rest config
func (*ReconcilerBase) GetScheme ¶
func (r *ReconcilerBase) GetScheme() *runtime.Scheme
GetScheme returns the scheme
func (*ReconcilerBase) IsInitialized ¶
func (r *ReconcilerBase) IsInitialized(obj metav1.Object) bool
IsInitialized determines if a CR instance is initialized. this implementation returns always true, should be overridden
func (*ReconcilerBase) IsValid ¶
func (r *ReconcilerBase) IsValid(obj metav1.Object) (bool, error)
IsValid determines if a CR instance is valid. this implementation returns always true, should be overridden
func (*ReconcilerBase) ManageError ¶
func (r *ReconcilerBase) ManageError(context context.Context, obj client.Object, issue error) (reconcile.Result, error)
ManageError will take care of the following: 1. generate a warning event attached to the passed CR 2. set the status of the passed CR to a error condition if the object implements the apis.ConditionsStatusAware interface 3. return a reconcile status with the passed error
func (*ReconcilerBase) ManageErrorWithRequeue ¶ added in v1.1.0
func (r *ReconcilerBase) ManageErrorWithRequeue(context context.Context, obj client.Object, issue error, requeueAfter time.Duration) (reconcile.Result, error)
ManageErrorWithRequeue will take care of the following: 1. generate a warning event attached to the passed CR 2. set the status of the passed CR to a error condition if the object implements the apis.ConditionsStatusAware interface 3. return a reconcile status with with the passed requeueAfter and error
func (*ReconcilerBase) ManageOutcomeWithRequeue ¶ added in v1.1.0
func (r *ReconcilerBase) ManageOutcomeWithRequeue(context context.Context, obj client.Object, issue error, requeueAfter time.Duration) (reconcile.Result, error)
ManageOutcomeWithRequeue is a convenience function to call either ManageErrorWithRequeue if issue is non-nil, else ManageSuccessWithRequeue
func (*ReconcilerBase) ManageSuccess ¶
func (r *ReconcilerBase) ManageSuccess(context context.Context, obj client.Object) (reconcile.Result, error)
ManageSuccess will update the status of the CR and return a successful reconcile result
func (*ReconcilerBase) ManageSuccessWithRequeue ¶ added in v1.1.0
func (r *ReconcilerBase) ManageSuccessWithRequeue(context context.Context, obj client.Object, requeueAfter time.Duration) (reconcile.Result, error)
ManageSuccessWithRequeue will update the status of the CR and return a successful reconcile result with requeueAfter set
type ResourceGenerationOrFinalizerChangedPredicate ¶
ResourceGenerationOrFinalizerChangedPredicate this predicate will fire an update event when the spec of a resource is changed (controller by ResourceGeneration), or when the finalizers are changed
func (ResourceGenerationOrFinalizerChangedPredicate) Update ¶
func (ResourceGenerationOrFinalizerChangedPredicate) Update(e event.UpdateEvent) bool
Update implements default UpdateEvent filter for validating resource version change