如何在不部署项目的情况下更新 instance_class 和 automatic_scaling 参数?

How do I update my instance_class and automatic_scaling params without deploying my project?

对于我的 google 云项目,我只想更新我的 app.yaml 文件,我 不想 部署我项目中的所有文件.我可以 运行 gcloud app deploy app.yaml 吗?我担心它会部署我的所有文件,而我目前不适合这样做。我找不到向我保证这就是我想要的文件。

更新: 我真正想要的是能够在不部署我的项目的情况下更新我的 instance_class & automatic_scaling 参数。

无法更改已部署的版本。如果您在 app.yaml 中修改了某些内容,无论更改有多么微小,都需要再次部署,因为 yaml 文件充当特定服务版本的部署描述符,并且所有应用程序都将使用命令 gcloud app 再次上传部署。

如果您因为服务会停机而不想再次部署,我建议您使用traffic splitting to specify a percentage distribution of traffic across two or more of the versions within a service. For example, in this case, you can deploy your new app version (NV) while the last version(LV) deployed is receiving all the traffic. Once that the NV is deployed, you can migrate all the tragic to this one. To prevent traffic from being automatically routed to the new version, use the --no-promote flag

要仅更改少数参数,例如缩放参数或实例 class,您可以使用 path REST api.

您不能为此使用常规的 gcloud CLI,您需要使用正确的正文构建自己的 REST 请求,然后对其进行修补。这比简单的 gcloud app deploy 更费功夫,但它确实有效!

根据您的情况,这里有一个示例,运行 此命令通过 Cloud SDK 或 Cloud Shell:

此命令适用于具有自动缩放功能的 GAE 应用程序,它会将您的最小实例更新为 3,将实例 class 更新为 F4。请务必使用您的应用信息更新 PROJECT-ID、SERVICE 和 VERSION。

 curl -X PATCH -H "Content-Type: application/json" \
 -d "{ 'automaticScaling': { 'standardSchedulerSettings': { 'minInstances': 3 } }, 'instanceClass': 'F4' }" \
 -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
 https://appengine.googleapis.com/v1/apps/PROJECT-ID/services/SERVICE/versions/VERSION?updateMask=automaticScaling.standard_scheduler_settings.min_instances,instanceClass

这里引用了 patch

Donnald C 为我指明了正确的方向,我找到了带有在线 API 资源管理器的文档,可帮助您设置和执行配置补丁。

https://cloud.google.com/appengine/docs/standard/php/config/setting-autoscaling-params-in-explorer