Support config short syntax and fix old bugs (#1230)

This commit is contained in:
Hang Yan
2020-01-05 10:19:22 +08:00
committed by GitHub
parent fe4301192a
commit 05e9bf4fc8
13 changed files with 209 additions and 77 deletions
+2 -2
View File
@@ -882,7 +882,7 @@ convert::expect_success "$cmd" "/tmp/output-os.json"
cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-config-short.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-k8s-config-short.json > /tmp/output-k8s.json
convert::expect_success_and_warning "$cmd" "/tmp/output-k8s.json"
convert::expect_success "$cmd" "/tmp/output-k8s.json"
cmd="kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-config-short-warning.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-k8s-config-short-warning.json > /tmp/output-k8s.json
@@ -917,7 +917,7 @@ convert::expect_success_and_warning "$cmd" "/tmp/output-os.json"
cmd="kompose --provider openshift convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-config-short.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-os-config-short.json > /tmp/output-os.json
convert::expect_success_and_warning "$cmd" "/tmp/output-os.json"
convert::expect_success "$cmd" "/tmp/output-os.json"
cmd="kompose --provider openshift convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/compose-endpoint-mode-1.yaml"
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/compose-v3.3-test/output-os-mode-1.json > /tmp/output-os.json
@@ -14,7 +14,7 @@
}
},
"data": {
"my-config.txt": "aaaa"
"my_config.txt": "aaaa"
}
},
{
@@ -59,8 +59,9 @@
"resources": {},
"volumeMounts": [
{
"mountPath": "/redis-config",
"name": "my-config"
"mountPath": "/redis_config",
"name": "my-config",
"subPath": "redis_config"
}
]
}
@@ -70,8 +71,14 @@
"volumes": [
{
"configMap": {
"name": "my-config",
"defaultMode": 288
"defaultMode": 288,
"items": [
{
"key": "my_config.txt",
"path": "redis_config"
}
],
"name": "my-config"
},
"name": "my-config"
}
@@ -14,7 +14,7 @@
}
},
"data": {
"my-config.txt": "aaaa"
"my_config.txt": "aaaa"
}
},
{
@@ -59,8 +59,9 @@
"resources": {},
"volumeMounts": [
{
"mountPath": "/redis-config",
"name": "my-config"
"mountPath": "/redis_config",
"name": "my-config",
"subPath": "redis_config"
}
]
}
@@ -70,8 +71,14 @@
"volumes": [
{
"configMap": {
"name": "my-config",
"defaultMode": 288
"defaultMode": 288,
"items": [
{
"key": "my_config.txt",
"path": "redis_config"
}
],
"name": "my-config"
},
"name": "my-config"
}
@@ -14,7 +14,7 @@
}
},
"data": {
"my-config.txt": "aaaa"
"my_config.txt": "aaaa"
}
},
{
@@ -56,12 +56,32 @@
"image": "redis:latest",
"imagePullPolicy": "",
"name": "redis",
"resources": {}
"resources": {},
"volumeMounts": [
{
"mountPath": "/my_config",
"name": "my-config",
"subPath": "my_config"
}
]
}
],
"restartPolicy": "Always",
"serviceAccountName": "",
"volumes": null
"volumes": [
{
"configMap": {
"items": [
{
"key": "my_config.txt",
"path": "my_config"
}
],
"name": "my-config"
},
"name": "my-config"
}
]
}
}
},
@@ -14,7 +14,7 @@
}
},
"data": {
"my-config.txt": "aaaa"
"my_config.txt": "aaaa"
}
},
{
@@ -56,12 +56,32 @@
"image": "redis:latest",
"imagePullPolicy": "",
"name": "redis",
"resources": {}
"resources": {},
"volumeMounts": [
{
"mountPath": "/my_config",
"name": "my-config",
"subPath": "my_config"
}
]
}
],
"restartPolicy": "Always",
"serviceAccountName": "",
"volumes": null
"volumes": [
{
"configMap": {
"items": [
{
"key": "my_config.txt",
"path": "my_config"
}
],
"name": "my-config"
},
"name": "my-config"
}
]
}
}
},
@@ -14,7 +14,7 @@
}
},
"data": {
"my-config.txt": "aaaa"
"my_config.txt": "aaaa"
}
},
{
@@ -71,6 +71,12 @@
"name": "my-config",
"configMap": {
"name": "my-config",
"items": [
{
"key": "my_config.txt",
"path": "redis_config"
}
],
"defaultMode": 288
}
}
@@ -83,7 +89,8 @@
"volumeMounts": [
{
"name": "my-config",
"mountPath": "/redis-config"
"mountPath": "/redis_config",
"subPath": "redis_config"
}
]
}
@@ -14,7 +14,7 @@
}
},
"data": {
"my-config.txt": "aaaa"
"my_config.txt": "aaaa"
}
},
{
@@ -66,11 +66,32 @@
}
},
"spec": {
"volumes": [
{
"name": "my-config",
"configMap": {
"name": "my-config",
"items": [
{
"key": "my_config.txt",
"path": "my_config"
}
]
}
}
],
"containers": [
{
"name": "redis",
"image": " ",
"resources": {}
"resources": {},
"volumeMounts": [
{
"name": "my-config",
"mountPath": "/my_config",
"subPath": "my_config"
}
]
}
],
"restartPolicy": "Always"
@@ -14,7 +14,7 @@
}
},
"data": {
"first-config.txt": "First config\n"
"first_config.txt": "First config\n"
}
},
{
@@ -61,8 +61,9 @@
"resources": {},
"volumeMounts": [
{
"mountPath": "/nginx.conf",
"name": "firstconfig"
"mountPath": "/etc/nginx.conf",
"name": "firstconfig",
"subPath": "nginx.conf"
},
{
"mountPath": "/var/www/nginx",
@@ -76,8 +77,14 @@
"volumes": [
{
"configMap": {
"name": "firstconfig",
"defaultMode": 644
"defaultMode": 644,
"items": [
{
"key": "first_config.txt",
"path": "nginx.conf"
}
],
"name": "firstconfig"
},
"name": "firstconfig"
},
@@ -126,7 +133,7 @@
}
},
"data": {
"second-config.txt": "Second config\n"
"second_config.txt": "Second config\n"
}
},
{
@@ -173,8 +180,9 @@
"resources": {},
"volumeMounts": [
{
"mountPath": "/nginx.conf",
"name": "secondconfig"
"mountPath": "/etc/nginx.conf",
"name": "secondconfig",
"subPath": "nginx.conf"
},
{
"mountPath": "/var/www/nginx",
@@ -188,8 +196,14 @@
"volumes": [
{
"configMap": {
"name": "secondconfig",
"defaultMode": 644
"defaultMode": 644,
"items": [
{
"key": "second_config.txt",
"path": "nginx.conf"
}
],
"name": "secondconfig"
},
"name": "secondconfig"
},
@@ -14,7 +14,7 @@
}
},
"data": {
"second-config.txt": "Second config\n"
"second_config.txt": "Second config\n"
}
},
{
@@ -61,8 +61,9 @@
"resources": {},
"volumeMounts": [
{
"mountPath": "/nginx.conf",
"name": "firstconfig"
"mountPath": "/etc/nginx.conf",
"name": "firstconfig",
"subPath": "nginx.conf"
},
{
"mountPath": "/var/www/nginx",
@@ -76,8 +77,14 @@
"volumes": [
{
"configMap": {
"name": "firstconfig",
"defaultMode": 644
"defaultMode": 644,
"items": [
{
"key": "second_config.txt",
"path": "nginx.conf"
}
],
"name": "firstconfig"
},
"name": "firstconfig"
},