매니페스트 보기

각 배포에는 해당 매니페스트가 있습니다. 매니페스트는 배포의 모든 리소스를 설명하고 새 배포마다 자동으로 생성되는 읽기 전용 속성입니다. 매니페스트는 생성된 후 수정될 수 없습니다. 매니페스트는 구성 파일과 동일하지 않지만, 구성 파일을 기준으로 생성됩니다.

시작하기 전에

매니페스트 구조

매니페스트는 세 가지 배포 보기를 제공합니다.

  • 초기 구성
  • 모든 템플릿 및 가져오기가 확장된 이후에 완전히 평가된 구성
  • 배포에 대한 모든 리소스를 계층 구조로 설명하는 배포 레이아웃

원래 구성

원래 구성은 템플릿 확장 전에 배포에 제공한 구성입니다. 초기 구성은 config 속성으로 표시됩니다.

config: |
  imports:
  - path: vm-template.jinja
  - path: network-template.jinja
  - path: firewall-template.jinja
  - path: compute-engine-template.jinja

  resources:
  - name: compute-engine-setup
    type: compute-engine-template.jinja

확장된 구성

확장된 구성은 모든 템플릿을 처리한 후 모든 리소스 및 그 속성이 포함된 배포에 대한 상세 설명이며 구성의 최종 상태입니다.

매니페스트의 확장된 구성 부분은 expandedConfig 속성으로 표시됩니다.

expandedConfig: |
  resources:
  - name: datadisk-example-config-with-templates
    properties:
      sizeGb: 100
      type: https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/diskTypes/pd-standard
      zone: us-central1-a
    type: compute.v1.disk
  - name: vm-example-config-with-templates
    properties:
      disks:
      - autoDelete: true
        boot: true
        deviceName: boot
        initializeParams:
          diskName: disk-example-config-with-templates
          sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140619
        type: PERSISTENT
      - autoDelete: true
        deviceName: datadisk-example-config-with-templates
        source: $(ref.datadisk-example-config-with-templates.selfLink)
        type: PERSISTENT
      machineType: https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/f1-micro
      metadata:
        items:
        - key: startup-script
          value: |
            #!/bin/bash
            python -m http.server 8080
      networkInterfaces:
      - accessConfigs:
        - name: External NAT
          type: ONE_TO_ONE_NAT
        network: https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default
      zone: us-central1-a
    type: compute.v1.instance

가져온 템플릿

매니페스트의 imports 속성에는 이 구성에서 가져온 모든 템플릿의 콘텐츠가 표시됩니다. 매니페스트의 가져오기 섹션은 imports 섹션으로 표시됩니다.

imports:
- content: |
    resources:
    - name: {{ env["name"] }}
      type: compute.v1.instance
      properties:
        disks:
        - autoDelete: true
          type: PERSISTENT
          boot: true
          deviceName: boot
          initializeParams:
            sourceImage:  https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140619
        machineType: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/zones/{{ properties["zone"] }}/machineTypes/{{ properties["machineType"] }}
        networkInterfaces:
        - network: $(ref.{{ properties["network"] }}.selfLink)
          accessConfigs:
          - name: External NAT
            type: ONE_TO_ONE_NAT
        zone: {{ properties["zone"] }}
        metadata:
          items:
          - key: startup-script
            value: |
              #!/bin/bash
              INSTANCE=$(curl http://metadata.google.internal/computeMetadata/v1/instance/hostname -H "Metadata-Flavor: Google")
              echo "<html><header><title>Hello from Deployment Manager!</title></header>
              <body><h2>Hello from $INSTANCE</h2>
              <p>Deployment Manager bids you good day!</p>
              </body>
              </html>" > index.html
              python -m http.server 80
  name: vm-template.jinja
- content: |
    resources:
    - name: {{ env["name"] }}
      type: compute.v1.network
      properties:
        IPv4Range: 10.0.0.1/16
  name: network-template.jinja
- content: |
    resources:
    - name: {{ env["name"]}}
      type: compute.v1.firewall
      properties:
        network: $(ref.{{ properties["network"] }}.selfLink)
        sourceRanges: ["0.0.0.0/0"]
        allowed:
        - IPProtocol: TCP
          ports: ["80"]
  name: firewall-template.jinja
- content: |
    {% set  NETWORK_NAME = "a-new-network" %}

    resources:
    - name: the-first-vm
      type: vm-template.jinja
      properties:
        machineType: f1-micro
        zone: us-central1-f
        network: {{ NETWORK_NAME }}
    - name: the-second-vm
      type: vm-template.jinja
      properties:
        machineType: g1-small
        zone: us-central1-f
        network: {{ NETWORK_NAME }}
    - name: {{ NETWORK_NAME }}
      type: network-template.jinja
    - name: {{ NETWORK_NAME }}-firewall
      type: firewall-template.jinja
      properties:
        network: {{ NETWORK_NAME }}
  name: compute-engine-template.jinja

레이아웃

레이아웃은 배포 및 해당 리소스의 개요이며 리소스 이름과 유형을 표시합니다.

레이아웃을 사용하여 배포 구조를 시각화하고, 초기 배포 중에 설정된 템플릿 속성을 보고, 확장되기 전의 구성에 대한 기타 정보를 확인할 수 있습니다.

매니페스트에서 layout 속성의 레이아웃을 확인할 수 있습니다.

layout: |
  resources:
  - name: compute-engine-setup
    resources:
    - name: the-first-vm
      properties:
        machineType: f1-micro
        network: a-new-network
        zone: us-central1-f
      resources:
      - name: the-first-vm
        type: compute.v1.instance
      type: vm-template.jinja
    - name: the-second-vm
      properties:
        machineType: g1-small
        network: a-new-network
        zone: us-central1-f
      resources:
      - name: the-second-vm
        type: compute.v1.instance
      type: vm-template.jinja
    - name: a-new-network
      resources:
      - name: a-new-network
        type: compute.v1.network
      type: network-template.jinja
    - name: a-new-network-firewall
      properties:
        network: a-new-network
      resources:
      - name: a-new-network-firewall
        type: compute.v1.firewall
      type: firewall-template.jinja
    type: compute-engine-template.jinja

매니페스트 식별

manifest-TIMESTAMP 형식의 고유 ID로 매니페스트를 식별할 수 있습니다. 예를 들면 다음과 같습니다.

manifest-1436393348324

일반적으로 해당 배포에 대한 정보를 가져오거나 배포에 대한 매니페스트를 나열하여 매니페스트 ID를 가져올 수 있습니다.

gcloud

Google Cloud CLI에서 deployments describe 하위 명령어를 사용합니다.

gcloud deployment-manager deployments describe example-deployment

gcloud는 다음과 비슷한 응답을 반환합니다.

id: '7428522736135856060'
manifest: https://www.googleapis.com/deploymentmanager/v2beta1/projects/myproject/global/deployments/example-deployment/manifests/manifest-1436393348324
name: example-deployment
resources:
NAME    TYPE      ID     STATE   ERRORS
...

API

API에서 GET 요청을 수행하고, 요청에 배포 이름을 제공합니다.

GET https://www.googleapis.com/deploymentmanager/v2beta1/projects/myproject/global/deployments/example-deployment-with-config

다음과 비슷한 응답이 표시됩니다.

{
 "id": "5899501332770090517",
 "creationTimestamp": "2015-03-30T15:40:58.809-07:00",
 "name": "example-deployment-with-config",
 "fingerprint": "",
 "manifest": "https://www.googleapis.com/deploymentmanager/v2/projects/myproject/global/deployments/example-deployment-with-config/manifests/manifest-1427755258810-2b3498d9-530b-4f8e-b014-0342d3c9c66b",
 "state": "DEPLOYED"
}

매니페스트 보기

매니페스트 리소스에 get() 요청을 수행하거나 Google Cloud console 또는 gcloud를 통해 매니페스트 를 볼 수 있습니다.

콘솔

배포의 매니페스트를 보려면 다음 안내를 따르세요. Google Cloud console

  1. 콘솔에서 배포 페이지 로 이동합니다. Google Cloud
  2. 목록에서 보려는 배포를 클릭합니다.
  3. 배포Console 세부정보에서 개요를 클릭합니다.

gcloud

Google Cloud CLI에서 manifests describe 명령어를 사용하여 전체 매니페스트를 확인합니다. 이 명령어는 전체 매니페스트와 레이아웃을 모두 나열합니다.

gcloud deployment-manager manifests describe manifest-1436393348324 \
    --deployment example-config-with-templates

gcloud는 다음과 비슷한 응답을 반환합니다.

 config: |
   imports: ["vm_template.jinja"]

resources:

  • name: vm-instance type: vm_template.jinja properties: zone: us-central1-a project: myproject creationTimestamp: '2015-03-30T15:40:58.815-07:00' evaluatedConfig: | resources:
  • name: datadisk-example-config-with-templates properties: sizeGb: 100 type: https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/diskTypes/pd-standard zone: us-central1-a type: compute.v1.disk
  • name: vm-example-config-with-templates properties: disks:
    • autoDelete: true boot: true deviceName: boot initializeParams: diskName: disk-example-config-with-templates sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140619 type: PERSISTENT
    • autoDelete: true deviceName: datadisk-example-config-with-templates source: $(ref.datadisk-example-config-with-templates.selfLink) type: PERSISTENT machineType: https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/f1-micro metadata: items:
      • key: startup-script value: | #!/bin/bash python -m http.server 8080 networkInterfaces:
    • accessConfigs:
      • name: External NAT type: ONE_TO_ONE_NAT network: https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default zone: us-central1-a type: compute.v1.instance id: '7174699452487462421' layout: | resources:
  • name: vm-instance type: vm_template.jinja properties: project: myproject zone: us-central1-a resources:
    • name: datadisk-example-config-with-templates type: compute.v1.disk
    • name: vm-example-config-with-templates type: compute.v1.instance name: manifest-1427755258810-2b3498d9-530b-4f8e-b014-0342d3c9c66b selfLink: https://www.googleapis.com/deploymentmanager/v2/projects/myproject/global/deployments/example-config-with-templates/manifests/manifest-1436393348324

API

API에서 GET 요청에 배포 이름과 매니페스트 이름을 제공합니다.

 GET https://www.googleapis.com/deploymentmanager/v2beta1/projects/myproject/global/deployments/example-deployment/manifests/manifest-1436393348324

다음과 비슷한 응답이 표시됩니다.

{
 "id": "7174699452487462421",
 "selfLink": "https://www.googleapis.com/deploymentmanager/v2/projects/myproject/global/deployments/example-config-with-templates/manifests/manifest-1436393348324",
 "creationTimestamp": "2015-03-30T15:40:58.815-07:00",
 "name": "manifest-1427755258810-2b3498d9-530b-4f8e-b014-0342d3c9c66b",
 "config": "imports: [\"vm_template.jinja\"]\n\nresources:\n- name: vm-instance\n  type: vm_template.jinja\n  properties:\n    zone: us-central1-a\n    project: myproject\n",
 "evaluatedConfig": "resources:\n- name: datadisk-example-config-with-templates\n  properties:\n    sizeGb: 100\n    type: https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/diskTypes/pd-standard\n    zone: us-central1-a\n  type: compute.v1.disk\n- name: vm-example-config-with-templates\n  properties:\n    disks:\n    - autoDelete: true\n      boot: true\n      deviceName: boot\n      initializeParams:\n        diskName: disk-example-config-with-templates\n        sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140619\n      type: PERSISTENT\n    - autoDelete: true\n      deviceName: datadisk-example-config-with-templates\n      source: $(ref.datadisk-example-config-with-templates.selfLink)\n      type: PERSISTENT\n    machineType: https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/f1-micro\n    metadata:\n      items:\n      - key: startup-script\n        value: |\n          #!/bin/bash\n          python -m http.server 8080\n    networkInterfaces:\n    - accessConfigs:\n      - name: External NAT\n        type: ONE_TO_ONE_NAT\n      network: https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default\n    zone: us-central1-a\n  type: compute.v1.instance\n",
 "layout": "resources:\n- name: vm-instance\n  properties:\n    project: myproject\n    zone: us-central1-a\n  resources:\n  - name: datadisk-example-config-with-templates\n    type: compute.v1.disk\n  - name: vm-example-config-with-templates\n    type: compute.v1.instance\n  type: vm_template.jinja\n"
}