Table of Contents

Delegate EntityRequeue<TEntity>

Namespace
KubeOps.Abstractions.Queue
Assembly
KubeOps.Abstractions.dll

Injectable delegate for requeueing entities.

Use this delegate when you need to pro-actively reconcile an entity after a certain amount of time. This is useful, if you want to check your entities periodically.

After the timeout is reached, the entity is fetched from the API and passed to the controller for reconciliation. If the entity was deleted in the meantime, the controller will not be called.

If the entity gets modified while the timeout is running, the timer is canceled and restarted, if another requeue is requested.

public delegate void EntityRequeue<TEntity>(TEntity entity, TimeSpan requeueIn) where TEntity : IKubernetesObject<V1ObjectMeta>

Parameters

entity TEntity

The instance of the entity that should be requeued.

requeueIn TimeSpan

The time to wait before another reconcile loop is fired.

Type Parameters

TEntity

The type of the entity.

Examples

Use the requeue delegate to repeatedly reconcile an entity after 5 seconds.

[EntityRbac(typeof(V1TestEntity), Verbs = RbacVerb.All)]
public class V1TestEntityController : IEntityController<V1TestEntity>
{
    private readonly EntityRequeue<V1TestEntity> _requeue;

    public V1TestEntityController(EntityRequeue<V1TestEntity> requeue)
    {
        _requeue = requeue;
    }

    public async Task ReconcileAsync(V1TestEntity entity, CancellationToken token)
    {
        _requeue(entity, TimeSpan.FromSeconds(5));
    }
}