Hi!
I have a question about how a redeployment of a Cognite Function works. Lets say we have the following scenario:
- A python backend fetches data from CDF in a pre-defined time window, cleans, and transforms it. Then calculates KPI timeseries.
- A deployed Cognite Function runs the backend on a schedule every 10 minutes. The calculated KPI time series is appended to an existing Time Series object in CDF. I.e., the Time Series is updated with KPIs for the last 10 minutes every 10 minutes.
- A frontend reads data from the regularly updated Time Series in CDF and visualizes it in various ways.
This workflow goes on normally for quite some time, until we have developed new functionality in our backend. We want to redeploy the Cognite Function with the new functionality. What happens now?
- Do we have to delete the old function before creating the new one? This may lead to downtime if the deployment for some reason takes so long that we move into the next time window for the the data fetch. Our Time Series in CDF may then have holes of missing data due to the downtime.
- Can we redeploy with the same ID and get some kind of no-downtime rollout of the new function? I assume the CF lives as a pod in a kubernetes cluster, which should be able to deliver these kinds of rollouts, but I cannot find anything in the documentation about this.
- Would we have to implement some kind of rollout scheme ourselves in the handle function to reduce the chance of downtime? For example by deploying the new function alongside the old (different id), monitor the health by making sure it actually gets deployed and passes some kind of default health test, and only then do we kill the old one? We would have to add some kind of random string to the new function external_id to distinguish between the old and new.
Perhaps someone can provide helpful thoughts on how the deployments take place under the hood, and provide best practices for solutions that require some degree of robustness and reliability?
Thanks in advance and have a great weekend!
Anders