Documentation ¶
Index ¶
- func AddFinalizer(obj metav1.Object, finalizer string)
- func HasFinalizer(obj metav1.Object, finalizer string) bool
- func IsBeingDeleted(obj metav1.Object) bool
- func IsOwner(owner, owned metav1.Object) bool
- func ProcessTemplate(data interface{}, template *template.Template) (*unstructured.Unstructured, error)
- func ProcessTemplateArray(data interface{}, template *template.Template) (*[]unstructured.Unstructured, error)
- func RemoveFinalizer(obj metav1.Object, finalizer string)
- type ReconcilerBase
- func (r *ReconcilerBase) CreateIfNotExistTemplatedResources(owner metav1.Object, namespace string, data interface{}, ...) error
- func (r *ReconcilerBase) CreateOrUpdateResource(owner metav1.Object, namespace string, obj metav1.Object) error
- func (r *ReconcilerBase) CreateOrUpdateResources(owner metav1.Object, namespace string, objs []metav1.Object) error
- func (r *ReconcilerBase) CreateOrUpdateTemplatedResources(owner metav1.Object, namespace string, data interface{}, ...) error
- func (r *ReconcilerBase) CreateResourceIfNotExists(owner metav1.Object, namespace string, obj metav1.Object) error
- func (r *ReconcilerBase) CreateResourcesIfNotExist(owner metav1.Object, namespace string, objs []metav1.Object) error
- func (r *ReconcilerBase) DeleteResource(obj metav1.Object) error
- func (r *ReconcilerBase) DeleteResources(objs []metav1.Object) error
- func (r *ReconcilerBase) DeleteTemplatedResources(data interface{}, template *template.Template) error
- func (r *ReconcilerBase) GetClient() client.Client
- func (r *ReconcilerBase) GetDiscoveryClient() (*discovery.DiscoveryClient, error)
- func (r *ReconcilerBase) GetDynamicClientOnAPIResource(resource metav1.APIResource) (dynamic.NamespaceableResourceInterface, error)
- func (r *ReconcilerBase) GetDynamicClientOnUnstructured(obj unstructured.Unstructured) (dynamic.NamespaceableResourceInterface, 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(obj metav1.Object, issue error) (reconcile.Result, error)
- func (r *ReconcilerBase) ManageSuccess(obj metav1.Object) (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
func HasFinalizer ¶
HasFinalizer returns whether this object has the passed finalizer
func IsBeingDeleted ¶
IsBeingDeleted returns whether this object has been requested to be deleted
func ProcessTemplate ¶
func ProcessTemplate(data interface{}, template *template.Template) (*unstructured.Unstructured, error)
ProcessTemplate processes an initialized Go template with a set of data. It expects one API object to be defined in the template
func ProcessTemplateArray ¶
func ProcessTemplateArray(data interface{}, template *template.Template) (*[]unstructured.Unstructured, error)
ProcessTemplateArray processes an initialized Go template with a set of data. It expects an arrays of API objects to be defined in the template. Dishomogeneus types are supported
func RemoveFinalizer ¶
RemoveFinalizer removes the passed finalizer from object
Types ¶
type ReconcilerBase ¶
type ReconcilerBase struct {
// contains filtered or unexported fields
}
ReconcilerBase is a base struct from which all reconcilers can be derived. By doing so your finalizers will also inherir a set of utility functions To inherit from reconciler just build your finalizer this way:
type MyReconciler struct { util.ReconcilerBase ... other optional fields ... }
func NewReconcilerBase ¶
func NewReconcilerBase(client client.Client, scheme *runtime.Scheme, restConfig *rest.Config, recorder record.EventRecorder) ReconcilerBase
NewReconcilerBase is a contructionr fucntion to create a new ReconcilerBase. To use ReconsicerBase as the base for you reconciler, replace the standart consturctor generated by the oiperator sdk with this:
func newReconciler(mgr manager.Manager) reconcile.Reconciler { return &MyReconciler{ ReconcilerBase: util.NewReconcilerBase(mgr.GetClient(), mgr.GetScheme(),mgr.GetConfig()), } }
func (*ReconcilerBase) CreateIfNotExistTemplatedResources ¶
func (r *ReconcilerBase) CreateIfNotExistTemplatedResources(owner metav1.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(owner metav1.Object, namespace string, obj metav1.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(owner metav1.Object, namespace string, objs []metav1.Object) error
CreateOrUpdateResources operates as CreateOrUpdate, but on an array of resources
func (*ReconcilerBase) CreateOrUpdateTemplatedResources ¶
func (r *ReconcilerBase) CreateOrUpdateTemplatedResources(owner metav1.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) CreateResourceIfNotExists ¶
func (r *ReconcilerBase) CreateResourceIfNotExists(owner metav1.Object, namespace string, obj metav1.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(owner metav1.Object, namespace string, objs []metav1.Object) error
CreateResourcesIfNotExist operates as CreateResourceIfNotExists, but on an array of resources
func (*ReconcilerBase) DeleteResource ¶
func (r *ReconcilerBase) DeleteResource(obj metav1.Object) error
DeleteResource deletes an existing resource. It doesn't fail if the resource does not exist
func (*ReconcilerBase) DeleteResources ¶
func (r *ReconcilerBase) DeleteResources(objs []metav1.Object) error
DeleteResources operates like DeleteResources, but on an arrays of resources
func (*ReconcilerBase) DeleteTemplatedResources ¶
func (r *ReconcilerBase) DeleteTemplatedResources(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) GetClient ¶
func (r *ReconcilerBase) GetClient() client.Client
GetClient returns the underlying client
func (*ReconcilerBase) GetDiscoveryClient ¶
func (r *ReconcilerBase) GetDiscoveryClient() (*discovery.DiscoveryClient, error)
GetDiscoveryClient returns a disocvery client for the current reconciler
func (*ReconcilerBase) GetDynamicClientOnAPIResource ¶
func (r *ReconcilerBase) GetDynamicClientOnAPIResource(resource metav1.APIResource) (dynamic.NamespaceableResourceInterface, error)
GetDynamicClientOnAPIResource returns a dynamic client on an APIResource. This client can be further namespaced.
func (*ReconcilerBase) GetDynamicClientOnUnstructured ¶
func (r *ReconcilerBase) GetDynamicClientOnUnstructured(obj unstructured.Unstructured) (dynamic.NamespaceableResourceInterface, error)
GetDynamicClientOnUnstructured returns a dynamic client on an Unstructured type. This client can be further namespaced.
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
func (*ReconcilerBase) ManageError ¶
func (*ReconcilerBase) ManageSuccess ¶
type ResourceGenerationOrFinalizerChangedPredicate ¶
ResourceGenerationOrFinalizerChangedPredicate this producates 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