从YAML配置文件进行部署时,如何配置Google Compute实例以允许http流量?

时间:2019-01-30 15:19:01

标签: yaml google-compute-engine google-deployment-manager

正如标题所示,我正在尝试在GCP中配置部署。目前,所有部署都由一个Compute实例组成,尽管我在尝试将http-server和https-server标记添加到配置文件时遇到麻烦。实例创建良好,无需尝试添加标签。这是我的yaml文件的顶部:

resources:
- type: compute.v1.instance
  name: [redacted]
  properties:
    zone: europe-west1-b
    # Allow http and https traffic
    tags:
    - http-server
    - https-server
    machineType: https://www.googleapis.com/compute/v1/projects/[redacted]/zones/europe-west1-b/machineTypes/f1-micro
.......etc

我得到的错误是:

ERROR: (gcloud.deployment-manager.deployments.create) Error in Operation [operation-1548860751491-580ae3ee63331-467fd040-1f00fce0]: errors:
- code: CONDITION_NOT_MET
  location: /deployments/[redacted]/resources/[redacted]>$.properties
  message: '"/tags": domain: validation; keyword: type; message: instance does not
    match any allowed primitive type; allowed: ["object"]; found: "array"'

这是我第一次尝试编写yaml配置文件,因此可能存在一些简单的上下文问题。

1 个答案:

答案 0 :(得分:1)

我设法自己修复它:

tags:
  items:
  - http-server
  - https-server