I am adding a VPC Serverless access connector to my cloud run service. I typically deploy with VS code using the cloud code plugin, and I build the image locally using Docker. Whenever I do this, I noticed that the network configuration I applied to a previous revision in the GCP console, namely, adding the VPC access connector, as well as creating an ingress, don't get applied to any new revision.
I actually noticed that when I deploy using buildpack instead of Docker, the network settings seem to "carry over" from the previous revision, but using the new image.
But I typically don't use buildpack, so I'd like that every time I deploy a new image (first building locally with docker) the network configuration from the previous revision carries over. Is this a bug? Or is there some setting to persist network configurations to subsequent revisions?
Note on the second picture it says I deployed "using cloud console" because I redeployed on the console in order to set the network settings to that revision, where the first image (most recent revision) I deployed from cloud code vs plugin.
The reason why network settings are retained when you redeploy using buildpack is because Cloud Run abstracts away the complexities of building and configuring the container image. It ensures that the necessary settings are persisted when the new container is deployed, including network settings.
On the other hand, when deploying a Docker container to Cloud Run, you need to build the container image yourself using the Dockerfile, including all the necessary configurations for network settings and other runtime requirements.
Hope this helps.
References:
https://cloud.google.com/docs/buildpacks/overview https://cloud.google.com/run/docs/deploying#console