Automation Assembler 템플릿 설계는 시스템 클러스터를 배포하고 디스크 클러스터를 연결할 수 있습니다.
시스템 및 디스크 클러스터를 배포하려면 클라우드 템플릿에서 allocatePerInstance 리소스 플래그와 count.index 및 map_to_object 표현식 구문을 활용하십시오.
다음 클라우드 템플릿 코드 예는 클러스터를 배포하는 설계에 대한 지침으로 사용할 수 있습니다.
디스크 클러스터를 공유하는 2개의 시스템
resources:
app0:
type: Cloud.Machine
allocatePerInstance: true
properties:
image: ubuntu
flavor: small
attachedDisks: '${map_to_object(slice(resource.disk[*].id, 0,2), "source")}'
app1:
type: Cloud.Machine
allocatePerInstance: true
properties:
image: ubuntu
flavor: small
attachedDisks: '${map_to_object(slice(resource.disk[*].id, 2,4), "source")}'
disk:
type: Cloud.Volume
allocatePerInstance: true
properties:
count: 4
capacityGb: 5
각각 디스크가 하나씩 있는 가변적 시스템 수
inputs:
count:
type: integer
default: 2
resources:
Cloud_Machine_1:
type: Cloud.Machine
allocatePerInstance: true
properties:
image: ubuntu
flavor: small
count: '${input.count}'
attachedDisks: '${map_to_object(slice(resource.disk[*].id, count.index, count.index + 1), "source")}'
disk:
type: Cloud.Volume
allocatePerInstance: true
properties:
count: '${input.count}'
capacityGb: 5
각각 디스크가 2개씩 있는 가변적 시스템 수
inputs:
count:
type: integer
default: 2
resources:
Cloud_Machine_1:
type: Cloud.Machine
allocatePerInstance: true
properties:
image: ubuntu
flavor: small
count: ${input.count}
attachedDisks: '${map_to_object(slice(resource.disk[*].id, 2*count.index, 2*(count.index + 1)), "source")}'
disk:
type: Cloud.Volume
allocatePerInstance: true
properties:
count: ${2*input.count}
capacityGb: 5
요청 시 디스크 크기 설정
inputs:
disksize:
type: array
minItems: 2
maxItems: 2
items:
type: object
properties:
size:
type: integer
resources:
app:
type: Cloud.Machine
allocatePerInstance: true
properties:
flavor: small
image: ubuntu
attachedDisks: ${map_to_object(slice(resource.disk[*].id, 0, 2), 'source')}
disk:
type: Cloud.Volume
allocatePerInstance: true
properties:
count: 2
capacityGb: ${input.disksize[count.index].size}