Support use configmap as volume (#1216)

This commit is contained in:
Hang Yan
2019-12-28 01:02:27 +08:00
committed by GitHub
parent bc32e29ee4
commit 34b827c97e
11 changed files with 435 additions and 20 deletions
@@ -0,0 +1,7 @@
version: "3"
services:
web:
image: nginx
volumes:
- ./tls:/etc/tls
- ./tls/a.key:/etc/test-a-key.key
+121
View File
@@ -0,0 +1,121 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
},
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
},
"name": "web"
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"io.kompose.service": "web"
}
},
"strategy": {
"type": "Recreate"
},
"template": {
"metadata": {
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
},
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
}
},
"spec": {
"containers": [
{
"image": "nginx",
"imagePullPolicy": "",
"name": "web",
"resources": {},
"volumeMounts": [
{
"mountPath": "/etc/tls",
"name": "web-cm0"
},
{
"mountPath": "/etc/test-a-key.key",
"name": "web-cm1",
"subPath": "test-a-key.key"
}
]
}
],
"restartPolicy": "Always",
"serviceAccountName": "",
"volumes": [
{
"configMap": {
"name": "web-cm0"
},
"name": "web-cm0"
},
{
"configMap": {
"items": [
{
"key": "a.key",
"path": "test-a-key.key"
}
],
"name": "web-cm1"
},
"name": "web-cm1"
}
]
}
}
},
"status": {}
},
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "web-cm0",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
}
},
"data": {
"a.crt": "test-crt-data...",
"a.key": "test-key-data...."
}
},
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "web-cm1",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
},
"annotations": {
"use-subpath": "true"
}
},
"data": {
"a.key": "test-key-data...."
}
}
]
}
+161
View File
@@ -0,0 +1,161 @@
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "web",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
},
"annotations": {
"kompose.cmd": "%CMD%",
"kompose.version": "%VERSION%"
}
},
"spec": {
"strategy": {
"type": "Recreate",
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"web"
],
"from": {
"kind": "ImageStreamTag",
"name": "web:latest"
}
}
}
],
"replicas": 1,
"test": false,
"selector": {
"io.kompose.service": "web"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
}
},
"spec": {
"volumes": [
{
"name": "web-cm0",
"configMap": {
"name": "web-cm0"
}
},
{
"name": "web-cm1",
"configMap": {
"name": "web-cm1",
"items": [
{
"key": "a.key",
"path": "test-a-key.key"
}
]
}
}
],
"containers": [
{
"name": "web",
"image": " ",
"resources": {},
"volumeMounts": [
{
"name": "web-cm0",
"mountPath": "/etc/tls"
},
{
"name": "web-cm1",
"mountPath": "/etc/test-a-key.key",
"subPath": "test-a-key.key"
}
]
}
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "web",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
}
},
"spec": {
"tags": [
{
"name": "latest",
"annotations": null,
"from": {
"kind": "DockerImage",
"name": "nginx"
},
"generation": null,
"importPolicy": {}
}
]
},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "web-cm0",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
}
},
"data": {
"a.crt": "test-crt-data...",
"a.key": "test-key-data...."
}
},
{
"kind": "ConfigMap",
"apiVersion": "v1",
"metadata": {
"name": "web-cm1",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
},
"annotations": {
"use-subpath": "true"
}
},
"data": {
"a.key": "test-key-data...."
}
}
]
}
+1
View File
@@ -0,0 +1 @@
test-crt-data...
+1
View File
@@ -0,0 +1 @@
test-key-data....