2
votes

When using Google Endpoints with Cloud Run to provide the container service, one creates a YAML file (stagger 2.0 format) to specify the paths with all configurations. For EVERY CHANGE the following is what I do (based on the documentation (https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-functions)

Step 1: Deploying the Endpoints configuration

gcloud endpoints services deploy openapi-functions.yaml \
    --project ESP_PROJECT_ID

This gives me the following output:

Service Configuration [CONFIG_ID] uploaded for service [CLOUD_RUN_HOSTNAME]

Then,

Step 2: Download the script to local machine

chmod +x gcloud_build_image
./gcloud_build_image -s CLOUD_RUN_HOSTNAME \
    -c CONFIG_ID -p ESP_PROJECT_ID

Then,

Step 3: Re deploy the Cloud Run service

gcloud run deploy CLOUD_RUN_SERVICE_NAME \
  --image="gcr.io/ESP_PROJECT_ID/endpoints-runtime-serverless:CLOUD_RUN_HOSTNAME-CONFIG_ID" \
  --allow-unauthenticated \
  --platform managed \
  --project=ESP_PROJECT_ID

Is this the process for every API path change? Or is there a simpler direct method of updating the YAML file and uploading it somewhere?

Thanks.

2
Do you perform the step 2 and 3 everytime that you change the CLoud Endpoint YAML? - guillaume blaquiere
Yes. Is there a way I can avoid it? When I do not it takes the old config-id in the Cloud Run service - RmR
It's actually a best practice to re-deploy a Cloud Run application when there's a new configuration for your app. This allows you to separate code from config and do stuff like rollbacks cleanly. - Ahmet Alp Balkan

2 Answers

1
votes

Based on the documentation, yes, this would be the process for every API path change. However, this may change in the future as this feature is currently on beta as stated on the documentation you shared.

You may want to look over here in order to create a feature request to GCP so they can improve this feature in the future.

In the meantime, I could advise to create a script for this process as it is always the same steps and doing something in bash that runs these commands would help you automatize the task.

Hope you find this useful.

0
votes

When you use the default Cloud Endpoint image as described in the documentation the parameter --rollout_strategy=managed is automatically set.

You have to wait up to 1 minutes to use the new configuration. Personally it's what I observe in my deployments. Have a try on it!