Can we limit serverless deployment?

I already explained that running applications as serverless deployments in preview environments is highly beneficial. As a result, you might have the impression that an application must be serverless in all environments. That is certainly not the case. We can, for example, choose to run some applications as serverless deployments in the preview environment and run them as normal apps in those that are permanent.

To be fair, we could have more complicated arrangements wit running a serverless application in the staging environment but non-serverless in production. However, that would mean that we are not testing what we’re deploying to production. After all, serverless applications are not behaving in the same way as other types of deployments.

When should the final testing be performed?

Now, you could argue that preview environments are used for testing, so they should be the same as production. While it is true that testing is the primary function of preview environments, they are not used for the final round of testing. By their nature, preview environments are more lightweight and do not contain the whole system, only the parts required to validate pull requests. The real or final test is performed in the staging environment if we are performing continuous delivery, or in production, if we are practicing continuous deployment. The latter option would require some form of progressive delivery, which we might explore later. For now, I’ll assume that you are following the continuous delivery model and, therefore, the staging environment is the one that should be production-like.

All in all, we’ll explore how to make an application serverless only in preview environments, and continue being whatever it was before in permanent ones.

Since our jx-knative application is already serverless by default, we’ll go with the least possible effort and leave it as is, but disable knativeDeploy in values for the staging in production environments.

Cloning the staging environment repository

Our first order of business is to clone the staging environment repository.

Get hands-on with 1200+ tech skills courses.