How to Manage Traffic with Cloud Function and Manage Revision
About this article
If you have used the Google Cloud Function, you'll notice how easy it can deploy code and without worry the backend managed services by Google, so you can focus on development, at this blog will focus on how to manage traffic and revision once you have to deploy more different version.
Pre Requirement
At this blog, we'll assume you already have deploy one cloud function on the cloud and everything is working, you are planning to deploy next version, however you don't want current production's version to be replaced, depend on how you configure right now, overtime when you deploy to google cloud, it might become the latest version.
So, how can you achieve?
Go to Cloud Run
Go to the cloud function, then click the Powered by Cloud Run
and go to the cloud run and click the EDIT & DEPLOY NEW REVISION
Uncheck Serve this revision immediately Now, uncheck this one so that every time when deploy new cloud function, it won't serve as latest immediately.
Manage Traffic
Now, since you check the above checkbox, new version won't serve traffic, but you have to manually click the Actions
af your new version to manually split the traffic.