Documentation ¶
Index ¶
- func DelayedRequeue() (ctrl.Result, error)
- func EndReconciliation() (ctrl.Result, error)
- func GetImageName(name string) string
- func Requeue(err error) (ctrl.Result, error)
- func SetVersionLabel(object metav1.Object, version string)
- func UpdateAnnotations(object metav1.Object, annotations map[string]string)
- func UpdateLabels(object metav1.Object, labels map[string]string)
- type ObjectHandler
- type SubReconciler
- type SubReconcilerResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DelayedRequeue ¶
Trigger a reschedule after a short delay.
func EndReconciliation ¶
Don't trigger a reschedule, we're done.
func SetVersionLabel ¶
Set version labels on an Object, default to the MetalK8s version
func UpdateAnnotations ¶
Update annotations on an Object
Types ¶
type ObjectHandler ¶
type ObjectHandler struct { // The client used to interact with the APIServer Client client.Client // contains filtered or unexported fields }
Struct used to manage Kubernetes objects creation, update and deletion that allow to use a single entry point to manage various objects and properly log actions and add some standard metadata
func NewObjectHandler ¶
func NewObjectHandler(instance client.Object, client client.Client, scheme *runtime.Scheme, recorder record.EventRecorder, logger logr.Logger, component string, name string) *ObjectHandler
Initiate an ObjectHandler struct
func (ObjectHandler) CreateOrUpdateOrDelete ¶
func (h ObjectHandler) CreateOrUpdateOrDelete(ctx context.Context, objsToUpdate []client.Object, objsToDelete []client.Object, mutate func(client.Object) error) (bool, error)
Create, Update or delete objects so that it match desired object from args return wether or not some objects get changed (Created, Updated, Deleted) NOTE: The objsToUpdate contains the objects to Update and to Create NOTE: This function will call the mutate function on every objects to Update (check controllerutil.CreateOrUpdate for more information) NOTE: (To keep in mind) This function will Create, Update, Delete all objects in a single call (so in a single Reconcile loop) but stop on the first error
func (ObjectHandler) GetMatchingLabels ¶
func (h ObjectHandler) GetMatchingLabels(includeVersion bool) client.MatchingLabels
Get Standard Labels matcher that can be used to list objects
func (ObjectHandler) SendEvent ¶
func (h ObjectHandler) SendEvent(status metav1.ConditionStatus, reason string, message string)
Send an event to the instance
type SubReconciler ¶
type SubReconciler interface { Load(*ObjectHandler, logr.Logger, *metalk8sscalitycomv1alpha1.ClusterConfig) GetLogger() logr.Logger Reconcile(context.Context) SubReconcilerResult }
Interface for all SubReconciler
type SubReconcilerResult ¶
type SubReconcilerResult struct {
// contains filtered or unexported fields
}
func NeedEndReconciliation ¶
func NeedEndReconciliation() SubReconcilerResult
End the reconciliation
func NothingToDo ¶
func NothingToDo() SubReconcilerResult
Nothing to do, reconcilitation can continue
func (SubReconcilerResult) GetResult ¶
func (r SubReconcilerResult) GetResult() (ctrl.Result, error)
Get the Return for the main Reconcile function
func (SubReconcilerResult) IsSuperior ¶
func (r SubReconcilerResult) IsSuperior(r2 SubReconcilerResult) bool
Compare if it's more important result
func (SubReconcilerResult) ShouldReturn ¶
func (r SubReconcilerResult) ShouldReturn() bool
Return wether or not the main Reconcile function should return