Skip to content

[bug]: v8.0.0 requeuing - polling stops completely after some time if status updated #707

@slacki123

Description

@slacki123

Describe the bug

I have set up my controller as follows

  public class ClusterController : IEntityController<MyEntity>
{
    private readonly EntityRequeue<MyEntity> _requeue;
    private readonly IKubernetesClient _client;

    public ClusterController(
        EntityRequeue<MyEntity> requeue,
        IKubernetesClient client)
    {
        _requeue = requeue;
        _client = client;
    }

    public async Task ReconcileAsync(MyEntity myEntity)
    {
        if (!myEntity.Spec.Enabled)
        {
            return; // will not trigger a requeue
        }
        
        myEntity.Status = // ** some status update code ** //
        await  _client.UpdateStatusAsync(myEntity);
  
        var pollingRate = TimeSpan.FromSeconds(myEntity.Spec.ReconciliationLoopPollSeconds);
        _requeue(myEntity, pollingRate);
    }

I then create the relevant CRD and custom resource, and I pass the requeuing frequency into the requeue function.

If I set the requeue time to about 1 second, then the requeuing no longer happens after approximately 15 seconds
If I set the requeue time to 5 seconds, then the requeuing stops after 20-40 seconds.
If requeue set to 60 seconds, it requeued about 8 times and then stopped
The number of requeues or time after it stops appears to be random.

To reproduce

  1. Set up and register the KubeOps controller with the correct custom resource type

  2. Set up the queue, and pass a requeue value, for example 5 seconds

  3. Use UpdateStatusAsync(TEntity entity) method at the end of every reconciliation loop, but before requeue. Use new status value each time

  4. Run the operator and apply the custom resource

  5. See that the polling stops after a number of retries and does not continue until the custom resource is changed

Expected behavior

The queuing / polling should continue indefinitely

Screenshots

No response

Additional Context

OS: Mac OS
IDE: Rider
.net version: 8.0.0
kubernetes env: Kubernetes In Docker (Kind), (v1.27.2 client, v1.24.0 server)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions