forked from LaconicNetwork/kompose
Support assign nodeport port in labels (#1210)
This commit is contained in:
@@ -488,6 +488,19 @@ convert::expect_failure "kompose -f $KOMPOSE_ROOT/script/test/fixtures/dockerfil
|
||||
convert::expect_failure "kompose -f $KOMPOSE_ROOT/script/test/fixtures/label-port/docker-compose.yml convert --stdout"
|
||||
|
||||
|
||||
####
|
||||
# test node port with port set
|
||||
cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/service-label/docker-compose.yaml convert --stdout -j"
|
||||
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/service-label/output-k8s.json > /tmp/output-k8s.json
|
||||
convert::expect_success "$cmd" "/tmp/output-k8s.json"
|
||||
|
||||
cmd="kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/service-label/docker-compose.yaml convert --stdout -j"
|
||||
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/service-label/output-oc.json > /tmp/output-oc.json
|
||||
convert::expect_success "$cmd" "/tmp/output-oc.json"
|
||||
|
||||
|
||||
|
||||
|
||||
######
|
||||
# Test the output file behavior of kompose convert
|
||||
# Default behavior without -o
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
version: '2'
|
||||
services:
|
||||
mariadb:
|
||||
ports:
|
||||
- '3306:3306'
|
||||
labels:
|
||||
kompose.service.type: nodeport
|
||||
kompose.service.nodeport.port: "33111"
|
||||
image: 'bitnami/mariadb:latest'
|
||||
environment:
|
||||
- MARIADB_USER=bn_wordpress
|
||||
- MARIADB_DATABASE=bitnami_wordpress
|
||||
- ALLOW_EMPTY_PASSWORD=yes
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
{
|
||||
"kind": "List",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {},
|
||||
"items": [
|
||||
{
|
||||
"kind": "Service",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "mariadb",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "mariadb"
|
||||
},
|
||||
"annotations": {
|
||||
"kompose.cmd": "%CMD%",
|
||||
"kompose.service.nodeport.port": "33111",
|
||||
"kompose.service.type": "nodeport",
|
||||
"kompose.version": "%VERSION%"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"ports": [
|
||||
{
|
||||
"name": "3306",
|
||||
"port": 3306,
|
||||
"targetPort": 3306,
|
||||
"nodePort": 33111
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"io.kompose.service": "mariadb"
|
||||
},
|
||||
"type": "NodePort"
|
||||
},
|
||||
"status": {
|
||||
"loadBalancer": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "Deployment",
|
||||
"metadata": {
|
||||
"annotations": {
|
||||
"kompose.cmd": "%CMD%",
|
||||
"kompose.service.nodeport.port": "33111",
|
||||
"kompose.service.type": "nodeport",
|
||||
"kompose.version": "%VERSION%"
|
||||
},
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "mariadb"
|
||||
},
|
||||
"name": "mariadb"
|
||||
},
|
||||
"spec": {
|
||||
"replicas": 1,
|
||||
"selector": {
|
||||
"matchLabels": {
|
||||
"io.kompose.service": "mariadb"
|
||||
}
|
||||
},
|
||||
"strategy": {},
|
||||
"template": {
|
||||
"metadata": {
|
||||
"annotations": {
|
||||
"kompose.cmd": "%CMD%",
|
||||
"kompose.service.nodeport.port": "33111",
|
||||
"kompose.service.type": "nodeport",
|
||||
"kompose.version": "%VERSION%"
|
||||
},
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "mariadb"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"env": [
|
||||
{
|
||||
"name": "ALLOW_EMPTY_PASSWORD",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"name": "MARIADB_DATABASE",
|
||||
"value": "bitnami_wordpress"
|
||||
},
|
||||
{
|
||||
"name": "MARIADB_USER",
|
||||
"value": "bn_wordpress"
|
||||
}
|
||||
],
|
||||
"image": "bitnami/mariadb:latest",
|
||||
"imagePullPolicy": "",
|
||||
"name": "mariadb",
|
||||
"ports": [
|
||||
{
|
||||
"containerPort": 3306
|
||||
}
|
||||
],
|
||||
"resources": {}
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Always",
|
||||
"serviceAccountName": "",
|
||||
"volumes": null
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
{
|
||||
"kind": "List",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {},
|
||||
"items": [
|
||||
{
|
||||
"kind": "Service",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "mariadb",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "mariadb"
|
||||
},
|
||||
"annotations": {
|
||||
"kompose.cmd": "%CMD%",
|
||||
"kompose.service.nodeport.port": "33111",
|
||||
"kompose.service.type": "nodeport",
|
||||
"kompose.version": "%VERSION%"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"ports": [
|
||||
{
|
||||
"name": "3306",
|
||||
"port": 3306,
|
||||
"targetPort": 3306,
|
||||
"nodePort": 33111
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"io.kompose.service": "mariadb"
|
||||
},
|
||||
"type": "NodePort"
|
||||
},
|
||||
"status": {
|
||||
"loadBalancer": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": "DeploymentConfig",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "mariadb",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "mariadb"
|
||||
},
|
||||
"annotations": {
|
||||
"kompose.cmd": "%CMD%",
|
||||
"kompose.service.nodeport.port": "33111",
|
||||
"kompose.service.type": "nodeport",
|
||||
"kompose.version": "%VERSION%"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"strategy": {
|
||||
"resources": {}
|
||||
},
|
||||
"triggers": [
|
||||
{
|
||||
"type": "ConfigChange"
|
||||
},
|
||||
{
|
||||
"type": "ImageChange",
|
||||
"imageChangeParams": {
|
||||
"automatic": true,
|
||||
"containerNames": [
|
||||
"mariadb"
|
||||
],
|
||||
"from": {
|
||||
"kind": "ImageStreamTag",
|
||||
"name": "mariadb:latest"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"replicas": 1,
|
||||
"test": false,
|
||||
"selector": {
|
||||
"io.kompose.service": "mariadb"
|
||||
},
|
||||
"template": {
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "mariadb"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "mariadb",
|
||||
"image": " ",
|
||||
"ports": [
|
||||
{
|
||||
"containerPort": 3306
|
||||
}
|
||||
],
|
||||
"env": [
|
||||
{
|
||||
"name": "ALLOW_EMPTY_PASSWORD",
|
||||
"value": "yes"
|
||||
},
|
||||
{
|
||||
"name": "MARIADB_DATABASE",
|
||||
"value": "bitnami_wordpress"
|
||||
},
|
||||
{
|
||||
"name": "MARIADB_USER",
|
||||
"value": "bn_wordpress"
|
||||
}
|
||||
],
|
||||
"resources": {}
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Always"
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {}
|
||||
},
|
||||
{
|
||||
"kind": "ImageStream",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "mariadb",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "mariadb"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"tags": [
|
||||
{
|
||||
"name": "latest",
|
||||
"annotations": null,
|
||||
"from": {
|
||||
"kind": "DockerImage",
|
||||
"name": "bitnami/mariadb:latest"
|
||||
},
|
||||
"generation": null,
|
||||
"importPolicy": {}
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": {
|
||||
"dockerImageRepository": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user