siddhi-io / siddhi-operator

Operator allows you to run stream processing logic directly on a Kubernetes cluster
Apache License 2.0
17 stars 12 forks source link

Initial status of the SiddhiProcess becomes empty for a while #90

Closed BuddhiWathsala closed 5 years ago

BuddhiWathsala commented 5 years ago

Description: When we deploy a SiddhiProcess YAML at the initial step the status of the SiddhiProcess becomes empty. After that, it moves through general state change Pending -> Running. Though it would be better to have this pending state right after the kubectl installation of the SiddhiProcess.

Suggested Labels: Type improvement

Affected Product Version: 0.2.0-alpha

BuddhiWathsala commented 5 years ago

In order to fix this issue, we need to move the update pending status initially in the reconcile loop.

We are updating the status to Running or Error when we are creating the K8s artifacts(deployment, service, and ingress, etc). We are doing this because we need to create or update the artifact and according to the output of that creation, we are changing the status.

As described in this issue https://github.com/kubernetes-sigs/controller-runtime/issues/490 it is intended behavior to run reconcile loop twice for each request. Therefore we cannot move pending status change to top-level because if we do so it will execute as follow and Siddhi process comes to the pending state even after the creation of all the artifacts.

  1. The first call of the reconcile loop status becomes Pending.
  2. This reconcile loop creates K8s artifacts and come to the running or error status.
  3. In the second call of reconcile loop again status becomes Pending.
  4. But at this time there is no create or update to the existing artifacts. Therefore SiddhiProcess will be retained in the Pending state.

That is why we got rid of this Pending state currently.