【问题标题】:Deploying Cloud Run Service fails because of VPC Connector annotation由于 VPC 连接器注释,部署 Cloud Run 服务失败
【发布时间】:2021-05-11 21:15:32
【问题描述】:

今天部署新的云运行映像失败,出现以下错误:

ERROR: (gcloud.run.deploy) Annotation 'run.googleapis.com/vpc-access-connector' is not supported on resources of kind 'Service'. Supported kinds are: Revision, Job

这很奇怪,因为注释已经有一段时间没有更改了。

【问题讨论】:

    标签: google-cloud-platform terraform google-cloud-run


    【解决方案1】:

    显然,gcp 已停止在根服务元数据中支持该标记。如文档所述,标签应移动到模板的元数据中(请参阅 cloud run doc 中的 yaml 部分)。

    地形代码:

    resource "google_cloud_run_service" "gateway" {
      ... 
      template {
        metadata {
          annotations = {
            "run.googleapis.com/vpc-access-egress" : "all"
            "run.googleapis.com/vpc-access-connector": google_vpc_access_connector.connector.id
          }
        }
        spec {
          ...
        }
      }
      metadata {
        annotations = {
          "run.googleapis.com/launch-stage": "BETA"
    
          // I had the annotation here before
        }
      }
      ...
    }
    
    

    【讨论】:

    • 我认为 $root.metadata.annotations 从未支持过它。此类设置通常在 spec.template.metadata.annotations 下,因为它们是按修订的。
    猜你喜欢
    • 2021-06-18
    • 1970-01-01
    • 2021-11-24
    • 2019-10-24
    • 1970-01-01
    • 2018-04-13
    • 2020-01-26
    • 2022-07-07
    • 2019-12-24
    相关资源
    最近更新 更多