-
-
Notifications
You must be signed in to change notification settings - Fork 83
Description
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
-
Set up and register the KubeOps controller with the correct custom resource type
-
Set up the queue, and pass a requeue value, for example 5 seconds
-
Use
UpdateStatusAsync(TEntity entity)method at the end of every reconciliation loop, but before requeue. Use new status value each time -
Run the operator and apply the custom resource
-
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)