Capsule now can support attach volume when created. Also modify the template for the format of volume in capsule. User can either create a new volume when launch the capsule by specify the volume size, or use the existed available volumes by set the volumeID in the template. Now the volume could not support multiple attach to serveral container, just support: 1. one volume attach to one container 2. Several volumes attach to one container Part of blueprint introduce-compose Change-Id: I2e2afba94cb83e6e7924366cbd8135fe6d6eea16 Signed-off-by: Kevin Zhao <kevin.zhao@arm.com>
76 lines
1.5 KiB
YAML
76 lines
1.5 KiB
YAML
capsule_template_version: 2017-06-21
|
|
# use "-" because that the fields have many items
|
|
capsule_version: beta
|
|
kind: capsule
|
|
metadata:
|
|
name: capsule-example
|
|
labels:
|
|
app: web
|
|
nihao: baibai
|
|
restart_policy: always
|
|
spec:
|
|
containers:
|
|
- image: ubuntu
|
|
command:
|
|
- "/bin/bash"
|
|
image_pull_policy: ifnotpresent
|
|
workdir: /root
|
|
labels:
|
|
app: web
|
|
ports:
|
|
- name: nginx-port
|
|
containerPort: 80
|
|
hostPort: 80
|
|
protocol: TCP
|
|
resources:
|
|
allocation:
|
|
cpu: 1
|
|
memory: 1024
|
|
environment:
|
|
PATCH: /usr/local/bin
|
|
volumeMounts:
|
|
- name: volume1
|
|
mountPath: /data1
|
|
readOnly: True
|
|
- image: centos
|
|
command:
|
|
- "echo"
|
|
args:
|
|
- "Hello"
|
|
- "World"
|
|
image_pull_policy: ifnotpresent
|
|
workdir: /root
|
|
labels:
|
|
app: web01
|
|
ports:
|
|
- name: nginx-port
|
|
containerPort: 80
|
|
hostPort: 80
|
|
protocol: TCP
|
|
- name: mysql-port
|
|
containerPort: 3306
|
|
hostPort: 3306
|
|
protocol: TCP
|
|
resources:
|
|
allocation:
|
|
cpu: 1
|
|
memory: 1024
|
|
environment:
|
|
NWH: /usr/bin/
|
|
volumeMounts:
|
|
- name: volume2
|
|
mountPath: /data2
|
|
- name: volume3
|
|
mountPath: /data3
|
|
volumes:
|
|
- name: volume1
|
|
cinder:
|
|
size: 5
|
|
autoRemove: True
|
|
- name: volume2
|
|
cinder:
|
|
volumeID: 473e4a6a-99f2-4b42-88ce-5ab03a00b756
|
|
- name: volume3
|
|
cinder:
|
|
volumeID: f4246aa1-1c87-479c-a2ab-4dbaf0c3c7bb
|