add configmaps derived from file and dir

add tests and e2e
function isconfigfile check if we need to use configmap and mount in readonly
readonly not asigned because not fail e2e

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
This commit is contained in:
jose luis
2024-04-07 21:18:01 +02:00
parent 14152d4a81
commit 4cd0b268fc
9 changed files with 375 additions and 6 deletions
+1
View File
@@ -0,0 +1 @@
content from file auth.txt
@@ -0,0 +1 @@
content of file cert1.pem
@@ -0,0 +1,16 @@
services:
busy:
image: busybox
ports:
- "8081:8080"
- "8026:8025"
volumes:
- ./certs:/certs
- ./auth.txt:/auth.txt
- ./users.php:/users.php:ro
command:
[
"/bin/sh",
"-c",
"cat /auth.txt /users.php /certs/cert1.pem"
]
@@ -0,0 +1,116 @@
---
apiVersion: v1
kind: Service
metadata:
labels:
io.kompose.service: busy
name: busy
spec:
ports:
- name: "8081"
port: 8081
targetPort: 8080
- name: "8026"
port: 8026
targetPort: 8025
selector:
io.kompose.service: busy
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
io.kompose.service: busy
name: busy
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: busy
strategy:
type: Recreate
template:
metadata:
labels:
io.kompose.network/configmap-file-configs-default: "true"
io.kompose.service: busy
spec:
containers:
- args:
- /bin/sh
- -c
- cat /auth.txt /users.php /certs/cert1.pem
image: busybox
name: busy
ports:
- containerPort: 8080
hostPort: 8081
protocol: TCP
- containerPort: 8025
hostPort: 8026
protocol: TCP
volumeMounts:
- mountPath: /certs
name: busy-cm0
- mountPath: /auth.txt
name: busy-cm1
subPath: auth.txt
- mountPath: /users.php
name: busy-cm2
subPath: users.php
readOnly: true
restartPolicy: Always
volumes:
- configMap:
name: busy-cm0
name: busy-cm0
- configMap:
items:
- key: auth.txt
path: auth.txt
name: busy-cm1
name: busy-cm1
- configMap:
items:
- key: users.php
path: users.php
name: busy-cm2
name: busy-cm2
---
apiVersion: v1
data:
cert1.pem: |
content of file cert1.pem
kind: ConfigMap
metadata:
labels:
io.kompose.service: busy
name: busy-cm0
---
apiVersion: v1
data:
auth.txt: |
content from file auth.txt
kind: ConfigMap
metadata:
annotations:
use-subpath: "true"
labels:
io.kompose.service: busy
name: busy-cm1
---
apiVersion: v1
data:
users.php: |
content from file users.php
kind: ConfigMap
metadata:
annotations:
use-subpath: "true"
labels:
io.kompose.service: busy
name: busy-cm2
+1
View File
@@ -0,0 +1 @@
content from file users.php