added support for multiple-compose files

This commit is contained in:
Abhishek
2017-01-03 17:18:34 +05:30
parent 9c3fdaa48d
commit a5a3805760
18 changed files with 739 additions and 34 deletions
+5 -1
View File
@@ -98,6 +98,11 @@ convert::expect_failure "kompose -f $KOMPOSE_ROOT/script/test/fixtures/bundles/f
# Test related to kompose --bundle convert to ensure that docker bundles are converted properly
convert::expect_success "kompose --bundle $KOMPOSE_ROOT/script/test/fixtures/bundles/dab/docker-compose-bundle.dab convert --stdout" "$KOMPOSE_ROOT/script/test/fixtures/bundles/dab/output-k8s.json"
# Test related to multiple-compose files
# Kubernets test
convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-k8s.yml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-os.yml convert --stdout" "$KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/output-k8s.json" "Unsupported depends_on key - ignoring"
convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-k8s.yml -f $KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/docker-os.yml convert --stdout" "$KOMPOSE_ROOT/script/test/fixtures/multiple-compose-files/output-openshift.json" "Unsupported depends_on key - ignoring"
######
# Test related to kompose --bundle convert to ensure that DSB bundles are converted properly
convert::expect_success_and_warning "kompose --bundle $KOMPOSE_ROOT/script/test/fixtures/bundles/dsb/docker-voting-bundle.dsb convert --stdout" "$KOMPOSE_ROOT/script/test/fixtures/bundles/dsb/output-k8s.json" "Service cannot be created because of missing port."
@@ -170,5 +175,4 @@ convert::files_exist "kompose -f $KOMPOSE_ROOT/examples/docker-compose.yml conve
# Behavior with -o <dirname>/<dirname>/<filename>
convert::files_exist "kompose -f $KOMPOSE_ROOT/examples/docker-compose.yml convert -o output_dir/output_dir_nested/output_file" "$TEMP_DIR/output_dir/output_dir_nested" "$TEMP_DIR/output_dir/output_dir_nested/output_file"
exit $EXIT_STATUS
@@ -0,0 +1,27 @@
version: "2"
services:
mariadb:
image: centos/mariadb
ports:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: kubernetes
MYSQL_DATABASE: kubernetes
MYSQL_PASSWORD: kubernetes
MYSQL_USER: kubernetes
volumes:
- /var/lib/mysql
etherpad:
image: centos/etherpad
ports:
- "80:9001"
depends_on:
- mariadb
environment:
DB_HOST: kubernetes
DB_DBID: kubernetes
DB_PASS: kubernetes
DB_PORT: kubernetes
DB_USER: kubernetes
@@ -0,0 +1,27 @@
version: "2"
services:
mariadb:
image: centos/mariadb
ports:
- "3307"
environment:
MYSQL_ROOT_PASSWORD: openshift
MYSQL_DATABASE: openshift
MYSQL_PASSWORD: openshift
MYSQL_USER: openshift
volumes:
- /var/lib/mysql
etherpad:
image: centos/etherpad
ports:
- "80:9001"
depends_on:
- mariadb
environment:
DB_HOST: openshift
DB_DBID: openshift
DB_PASS: openshift
DB_PORT: openshift
DB_USER: openshift
@@ -0,0 +1,257 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "etherpad",
"creationTimestamp": null,
"labels": {
"service": "etherpad"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 80,
"targetPort": 9001
},
{
"name": "80",
"protocol": "TCP",
"port": 80,
"targetPort": 9001
}
],
"selector": {
"service": "etherpad"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "mariadb",
"creationTimestamp": null,
"labels": {
"service": "mariadb"
}
},
"spec": {
"ports": [
{
"name": "3306",
"protocol": "TCP",
"port": 3306,
"targetPort": 3306
},
{
"name": "3307",
"protocol": "TCP",
"port": 3307,
"targetPort": 3307
}
],
"selector": {
"service": "mariadb"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "etherpad",
"creationTimestamp": null
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "etherpad"
}
},
"spec": {
"containers": [
{
"name": "etherpad",
"image": "centos/etherpad",
"ports": [
{
"containerPort": 9001,
"protocol": "TCP"
},
{
"containerPort": 9001,
"protocol": "TCP"
}
],
"env": [
{
"name": "DB_USER",
"value": "openshift"
},
{
"name": "DB_DBID",
"value": "openshift"
},
{
"name": "DB_HOST",
"value": "openshift"
},
{
"name": "DB_PASS",
"value": "openshift"
},
{
"name": "DB_PORT",
"value": "openshift"
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "mariadb",
"creationTimestamp": null
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "mariadb"
}
},
"spec": {
"volumes": [
{
"name": "mariadb-claim0",
"persistentVolumeClaim": {
"claimName": "mariadb-claim0"
}
},
{
"name": "mariadb-claim1",
"persistentVolumeClaim": {
"claimName": "mariadb-claim1"
}
}
],
"containers": [
{
"name": "mariadb",
"image": "centos/mariadb",
"ports": [
{
"containerPort": 3306,
"protocol": "TCP"
},
{
"containerPort": 3307,
"protocol": "TCP"
}
],
"env": [
{
"name": "MYSQL_PASSWORD",
"value": "openshift"
},
{
"name": "MYSQL_ROOT_PASSWORD",
"value": "openshift"
},
{
"name": "MYSQL_USER",
"value": "openshift"
},
{
"name": "MYSQL_DATABASE",
"value": "openshift"
}
],
"resources": {},
"volumeMounts": [
{
"name": "mariadb-claim0",
"mountPath": "/var/lib/mysql"
},
{
"name": "mariadb-claim1",
"mountPath": "/var/lib/mysql"
}
]
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
},
{
"kind": "PersistentVolumeClaim",
"apiVersion": "v1",
"metadata": {
"name": "mariadb-claim0",
"creationTimestamp": null
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "100Mi"
}
}
},
"status": {}
},
{
"kind": "PersistentVolumeClaim",
"apiVersion": "v1",
"metadata": {
"name": "mariadb-claim1",
"creationTimestamp": null
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "100Mi"
}
}
},
"status": {}
}
]
}
@@ -0,0 +1,361 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "etherpad",
"creationTimestamp": null,
"labels": {
"service": "etherpad"
}
},
"spec": {
"ports": [
{
"name": "80",
"protocol": "TCP",
"port": 80,
"targetPort": 9001
},
{
"name": "80",
"protocol": "TCP",
"port": 80,
"targetPort": 9001
}
],
"selector": {
"service": "etherpad"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "mariadb",
"creationTimestamp": null,
"labels": {
"service": "mariadb"
}
},
"spec": {
"ports": [
{
"name": "3306",
"protocol": "TCP",
"port": 3306,
"targetPort": 3306
},
{
"name": "3307",
"protocol": "TCP",
"port": 3307,
"targetPort": 3307
}
],
"selector": {
"service": "mariadb"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "etherpad",
"creationTimestamp": null,
"labels": {
"service": "etherpad"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"etherpad"
],
"from": {
"kind": "ImageStreamTag",
"name": "etherpad:latest"
}
}
}
],
"replicas": 1,
"test": false,
"selector": {
"service": "etherpad"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "etherpad"
}
},
"spec": {
"containers": [
{
"name": "etherpad",
"image": " ",
"ports": [
{
"containerPort": 9001,
"protocol": "TCP"
},
{
"containerPort": 9001,
"protocol": "TCP"
}
],
"env": [
{
"name": "DB_DBID",
"value": "openshift"
},
{
"name": "DB_HOST",
"value": "openshift"
},
{
"name": "DB_PASS",
"value": "openshift"
},
{
"name": "DB_PORT",
"value": "openshift"
},
{
"name": "DB_USER",
"value": "openshift"
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "etherpad",
"creationTimestamp": null
},
"spec": {
"tags": [
{
"name": "latest",
"annotations": null,
"from": {
"kind": "DockerImage",
"name": "centos/etherpad"
},
"generation": null,
"importPolicy": {}
}
]
},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "mariadb",
"creationTimestamp": null,
"labels": {
"service": "mariadb"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"mariadb"
],
"from": {
"kind": "ImageStreamTag",
"name": "mariadb:latest"
}
}
}
],
"replicas": 1,
"test": false,
"selector": {
"service": "mariadb"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "mariadb"
}
},
"spec": {
"volumes": [
{
"name": "mariadb-claim0",
"persistentVolumeClaim": {
"claimName": "mariadb-claim0"
}
},
{
"name": "mariadb-claim1",
"persistentVolumeClaim": {
"claimName": "mariadb-claim1"
}
}
],
"containers": [
{
"name": "mariadb",
"image": " ",
"ports": [
{
"containerPort": 3306,
"protocol": "TCP"
},
{
"containerPort": 3307,
"protocol": "TCP"
}
],
"env": [
{
"name": "MYSQL_DATABASE",
"value": "openshift"
},
{
"name": "MYSQL_PASSWORD",
"value": "openshift"
},
{
"name": "MYSQL_ROOT_PASSWORD",
"value": "openshift"
},
{
"name": "MYSQL_USER",
"value": "openshift"
}
],
"resources": {},
"volumeMounts": [
{
"name": "mariadb-claim0",
"mountPath": "/var/lib/mysql"
},
{
"name": "mariadb-claim1",
"mountPath": "/var/lib/mysql"
}
]
}
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "mariadb",
"creationTimestamp": null
},
"spec": {
"tags": [
{
"name": "latest",
"annotations": null,
"from": {
"kind": "DockerImage",
"name": "centos/mariadb"
},
"generation": null,
"importPolicy": {}
}
]
},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "PersistentVolumeClaim",
"apiVersion": "v1",
"metadata": {
"name": "mariadb-claim0",
"creationTimestamp": null
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "100Mi"
}
}
},
"status": {}
},
{
"kind": "PersistentVolumeClaim",
"apiVersion": "v1",
"metadata": {
"name": "mariadb-claim1",
"creationTimestamp": null
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "100Mi"
}
}
},
"status": {}
}
]
}