<p>I have written a piece of code in k8s operator, this task is taking longer time to complete that blocking my reconciler till completing the task. I want to implement a logic where I will not have to wait till completing the task, instead, I want to get a notification to the reconciler after completing the task.</p>

SANTOSH KUMAR MISHRA
<p>As you've suggested, it is best practice to keep an operator's reconcile process as short-lived as possible to ensure that the operator can quickly reconcile events and communicate updates via the resource's status in a timely manner. The best way to optimize an operator's reconcile method will always be unique to the operator, but I've included a few scenario's that may apply to your operator:</p>
<p><strong>Scenario 1: When reconciling your CR, your operator needs to create a set of child resources and ensure that they are in some state.</strong></p>
<p>In this scenario, your best bet is to use <a href="https://book.kubebuilder.io/reference/watching-resources/operator-managed.html" rel="nofollow noreferrer">owner labels to requeue the CR</a> as the child resources reach the correct state. Your operator's reconcile method would need to be updated to:</p>
<ul>
<li>Create the resources if they do not exist.</li>
<li>Check that the resources are in the correct state.</li>
</ul>
<p><strong>Scenario 2: Your operator needs to perform long running logic when reconciling a resource</strong></p>
<p>In this scenario, it may make sense to move the long running logic into a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/" rel="nofollow noreferrer">Kubernetes Job</a> or externally ran process. Your operator controller would then need to requeue the CR once the job finishes, similar to the process described in scenario 1.</p>
<p>It's also possible to configure your operator to reconcile multiple CRs at once, but this won't fix an inherent design issue in your reconcile method.</p>
<p>Hopefully that helps, if the scenarios above don't apply, please reach out with additional details.</p>
