support for volumes_from docker-compose construct

Now a user can provide volumes_from to share volumes
from other service so here the PVC created for that
service will be shared by service calling volumes_from
This commit is contained in:
Suraj Deshmukh
2016-10-19 09:15:47 +05:30
parent d9899b788d
commit fd09efed43
9 changed files with 622 additions and 2 deletions
@@ -0,0 +1,20 @@
version: "2"
services:
web:
image: centos/httpd
volumes:
- "./app:/src/app"
ports:
- "3030:3000"
command: nodemon -L app/bin/www
nginx:
restart: always
image: nginx
ports:
- "80:80"
volumes:
- /www/public
volumes_from:
- web
@@ -0,0 +1,216 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "web",
"creationTimestamp": null,
"labels": {
"service": "web"
}
},
"spec": {
"ports": [
{
"name": "3030",
"protocol": "TCP",
"port": 3030,
"targetPort": 3000
}
],
"selector": {
"service": "web"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "nginx",
"creationTimestamp": null,
"labels": {
"service": "nginx"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 80,
"targetPort": 80
}
],
"selector": {
"service": "nginx"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "web",
"creationTimestamp": null
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "web"
}
},
"spec": {
"volumes": [
{
"name": "web-claim0",
"persistentVolumeClaim": {
"claimName": "web-claim0"
}
}
],
"containers": [
{
"name": "web",
"image": "centos/httpd",
"args": [
"nodemon",
"-L",
"app/bin/www"
],
"ports": [
{
"containerPort": 3000,
"protocol": "TCP"
}
],
"resources": {},
"volumeMounts": [
{
"name": "web-claim0",
"mountPath": "/src/app"
}
]
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
},
{
"kind": "PersistentVolumeClaim",
"apiVersion": "v1",
"metadata": {
"name": "web-claim0",
"creationTimestamp": null
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "100Mi"
}
}
},
"status": {}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "nginx",
"creationTimestamp": null
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "nginx"
}
},
"spec": {
"volumes": [
{
"name": "nginx-claim0",
"persistentVolumeClaim": {
"claimName": "nginx-claim0"
}
},
{
"name": "web-claim0",
"persistentVolumeClaim": {
"claimName": "web-claim0"
}
}
],
"containers": [
{
"name": "nginx",
"image": "nginx",
"ports": [
{
"containerPort": 80,
"protocol": "TCP"
}
],
"resources": {},
"volumeMounts": [
{
"name": "nginx-claim0",
"mountPath": "/www/public"
},
{
"name": "web-claim0",
"mountPath": "/src/app"
}
]
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
},
{
"kind": "PersistentVolumeClaim",
"apiVersion": "v1",
"metadata": {
"name": "nginx-claim0",
"creationTimestamp": null
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "100Mi"
}
}
},
"status": {}
}
]
}
@@ -0,0 +1,320 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "nginx",
"creationTimestamp": null,
"labels": {
"service": "nginx"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 80,
"targetPort": 80
}
],
"selector": {
"service": "nginx"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "web",
"creationTimestamp": null,
"labels": {
"service": "web"
}
},
"spec": {
"ports": [
{
"name": "3030",
"protocol": "TCP",
"port": 3030,
"targetPort": 3000
}
],
"selector": {
"service": "web"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "nginx",
"creationTimestamp": null,
"labels": {
"service": "nginx"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"nginx"
],
"from": {
"kind": "ImageStreamTag",
"name": "nginx:latest"
}
}
}
],
"replicas": 1,
"test": false,
"selector": {
"service": "nginx"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "nginx"
}
},
"spec": {
"volumes": [
{
"name": "nginx-claim0",
"persistentVolumeClaim": {
"claimName": "nginx-claim0"
}
},
{
"name": "web-claim0",
"persistentVolumeClaim": {
"claimName": "web-claim0"
}
}
],
"containers": [
{
"name": "nginx",
"image": " ",
"ports": [
{
"containerPort": 80,
"protocol": "TCP"
}
],
"resources": {},
"volumeMounts": [
{
"name": "nginx-claim0",
"mountPath": "/www/public"
},
{
"name": "web-claim0",
"mountPath": "/src/app"
}
]
}
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "nginx",
"creationTimestamp": null
},
"spec": {
"tags": [
{
"name": "latest",
"annotations": null,
"from": {
"kind": "DockerImage",
"name": "nginx"
},
"generation": null,
"importPolicy": {}
}
]
},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "PersistentVolumeClaim",
"apiVersion": "v1",
"metadata": {
"name": "nginx-claim0",
"creationTimestamp": null
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "100Mi"
}
}
},
"status": {}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "web",
"creationTimestamp": null,
"labels": {
"service": "web"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"web"
],
"from": {
"kind": "ImageStreamTag",
"name": "web:latest"
}
}
}
],
"replicas": 1,
"test": false,
"selector": {
"service": "web"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "web"
}
},
"spec": {
"volumes": [
{
"name": "web-claim0",
"persistentVolumeClaim": {
"claimName": "web-claim0"
}
}
],
"containers": [
{
"name": "web",
"image": " ",
"args": [
"nodemon",
"-L",
"app/bin/www"
],
"ports": [
{
"containerPort": 3000,
"protocol": "TCP"
}
],
"resources": {},
"volumeMounts": [
{
"name": "web-claim0",
"mountPath": "/src/app"
}
]
}
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "web",
"creationTimestamp": null
},
"spec": {
"tags": [
{
"name": "latest",
"annotations": null,
"from": {
"kind": "DockerImage",
"name": "centos/httpd"
},
"generation": null,
"importPolicy": {}
}
]
},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "PersistentVolumeClaim",
"apiVersion": "v1",
"metadata": {
"name": "web-claim0",
"creationTimestamp": null
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "100Mi"
}
}
},
"status": {}
}
]
}