Merge branch 'main' into feature-1846-network_mode-service

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
This commit is contained in:
jose luis
2024-04-25 17:31:49 +02:00
23 changed files with 1203 additions and 11 deletions
+24
View File
@@ -350,6 +350,30 @@ k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/hpa/compose.yaml convert
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/hpa/output-k8s.yaml"
convert::expect_success "$k8s_cmd" "$k8s_output" || exit 1
#Test auto configmaps from files/dir
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/compose-1.yaml convert --stdout --with-kompose-annotation=false"
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/output-k8s-1.yaml"
os_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/compose-1.yaml convert --provider openshift --stdout --with-kompose-annotation=false"
os_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/output-os-1.yaml"
convert::expect_success "$k8s_cmd" "$k8s_output" || exit 1
convert::expect_success "$os_cmd" "$os_output" || exit 1
#Test auto configmaps from files/dir
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/compose-2.yaml convert --stdout --with-kompose-annotation=false"
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/output-k8s-2.yaml"
os_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/compose-2.yaml convert --provider openshift --stdout --with-kompose-annotation=false"
os_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/output-os-2.yaml"
convert::expect_success "$k8s_cmd" "$k8s_output" || exit 1
convert::expect_success "$os_cmd" "$os_output" || exit 1
#Test auto configmaps from files/dir
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/compose-3.yaml convert --stdout --with-kompose-annotation=false"
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/output-k8s-3.yaml"
os_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/compose-3.yaml convert --provider openshift --stdout --with-kompose-annotation=false"
os_output="$KOMPOSE_ROOT/script/test/fixtures/configmap-file-configs/output-os-3.yaml"
convert::expect_success "$k8s_cmd" "$k8s_output" || exit 1
convert::expect_success "$os_cmd" "$os_output" || exit 1
# Test network_mode: service:
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/network-mode-service/compose.yaml convert --stdout --with-kompose-annotation=false"
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/network-mode-service/output-k8s.yaml"
+1
View File
@@ -0,0 +1 @@
content from file auth.txt
@@ -0,0 +1 @@
content from file cert2.pem
@@ -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,17 @@
services:
busy:
image: busybox
ports:
- "8081:8080"
- "8026:8025"
volumes:
- ./certs:/certs
- ./certs-level1/certs-level2/certs-level3/cert2.pem:/certs/cert2.pem
- ./auth.txt:/auth.txt
- ./users.php:/users.php:ro
command:
[
"/bin/sh",
"-c",
"cat /auth.txt /users.php /certs/cert1.pem /certs/cert2.pem"
]
@@ -0,0 +1,10 @@
services:
busy:
image: busybox
ports:
- "8081:8080"
- "8026:8025"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
@@ -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
@@ -0,0 +1,137 @@
---
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 /certs/cert2.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: /certs/cert2.pem
name: busy-cm1
subPath: cert2.pem
- mountPath: /auth.txt
name: busy-cm2
subPath: auth.txt
- mountPath: /users.php
name: busy-cm3
readOnly: true
subPath: users.php
restartPolicy: Always
volumes:
- configMap:
name: busy-cm0
name: busy-cm0
- configMap:
items:
- key: cert2.pem
path: cert2.pem
name: busy-cm1
name: busy-cm1
- configMap:
items:
- key: auth.txt
path: auth.txt
name: busy-cm2
name: busy-cm2
- configMap:
items:
- key: users.php
path: users.php
name: busy-cm3
name: busy-cm3
---
apiVersion: v1
data:
cert1.pem: |
content of file cert1.pem
kind: ConfigMap
metadata:
labels:
io.kompose.service: busy
name: busy-cm0
---
apiVersion: v1
data:
cert2.pem: content from file cert2.pem
kind: ConfigMap
metadata:
annotations:
use-subpath: "true"
labels:
io.kompose.service: busy
name: busy-cm1
---
apiVersion: v1
data:
auth.txt: |
content from file auth.txt
kind: ConfigMap
metadata:
annotations:
use-subpath: "true"
labels:
io.kompose.service: busy
name: busy-cm2
---
apiVersion: v1
data:
users.php: |
content from file users.php
kind: ConfigMap
metadata:
annotations:
use-subpath: "true"
labels:
io.kompose.service: busy
name: busy-cm3
@@ -0,0 +1,49 @@
---
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:
- image: busybox
name: busy
ports:
- containerPort: 8080
hostPort: 8081
protocol: TCP
- containerPort: 8025
hostPort: 8026
protocol: TCP
restartPolicy: Always
@@ -0,0 +1,144 @@
---
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.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
io.kompose.service: busy
name: busy
spec:
replicas: 1
selector:
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: ' '
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
readOnly: true
subPath: users.php
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
test: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- busy
from:
kind: ImageStreamTag
name: busy:latest
type: ImageChange
---
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
labels:
io.kompose.service: busy
name: busy
spec:
lookupPolicy:
local: false
tags:
- from:
kind: DockerImage
name: busybox
name: latest
referencePolicy:
type: ""
---
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
@@ -0,0 +1,165 @@
---
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.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
io.kompose.service: busy
name: busy
spec:
replicas: 1
selector:
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 /certs/cert2.pem
image: ' '
name: busy
ports:
- containerPort: 8080
hostPort: 8081
protocol: TCP
- containerPort: 8025
hostPort: 8026
protocol: TCP
volumeMounts:
- mountPath: /certs
name: busy-cm0
- mountPath: /certs/cert2.pem
name: busy-cm1
subPath: cert2.pem
- mountPath: /auth.txt
name: busy-cm2
subPath: auth.txt
- mountPath: /users.php
name: busy-cm3
readOnly: true
subPath: users.php
restartPolicy: Always
volumes:
- configMap:
name: busy-cm0
name: busy-cm0
- configMap:
items:
- key: cert2.pem
path: cert2.pem
name: busy-cm1
name: busy-cm1
- configMap:
items:
- key: auth.txt
path: auth.txt
name: busy-cm2
name: busy-cm2
- configMap:
items:
- key: users.php
path: users.php
name: busy-cm3
name: busy-cm3
test: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- busy
from:
kind: ImageStreamTag
name: busy:latest
type: ImageChange
---
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
labels:
io.kompose.service: busy
name: busy
spec:
lookupPolicy:
local: false
tags:
- from:
kind: DockerImage
name: busybox
name: latest
referencePolicy:
type: ""
---
apiVersion: v1
data:
cert1.pem: |
content of file cert1.pem
kind: ConfigMap
metadata:
labels:
io.kompose.service: busy
name: busy-cm0
---
apiVersion: v1
data:
cert2.pem: content from file cert2.pem
kind: ConfigMap
metadata:
annotations:
use-subpath: "true"
labels:
io.kompose.service: busy
name: busy-cm1
---
apiVersion: v1
data:
auth.txt: |
content from file auth.txt
kind: ConfigMap
metadata:
annotations:
use-subpath: "true"
labels:
io.kompose.service: busy
name: busy-cm2
---
apiVersion: v1
data:
users.php: |
content from file users.php
kind: ConfigMap
metadata:
annotations:
use-subpath: "true"
labels:
io.kompose.service: busy
name: busy-cm3
@@ -0,0 +1,77 @@
---
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.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
io.kompose.service: busy
name: busy
spec:
replicas: 1
selector:
io.kompose.service: busy
strategy:
type: Recreate
template:
metadata:
labels:
io.kompose.network/configmap-file-configs-default: "true"
io.kompose.service: busy
spec:
containers:
- image: ' '
name: busy
ports:
- containerPort: 8080
hostPort: 8081
protocol: TCP
- containerPort: 8025
hostPort: 8026
protocol: TCP
restartPolicy: Always
test: false
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- busy
from:
kind: ImageStreamTag
name: busy:latest
type: ImageChange
---
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
labels:
io.kompose.service: busy
name: busy
spec:
lookupPolicy:
local: false
tags:
- from:
kind: DockerImage
name: busybox
name: latest
referencePolicy:
type: ""
+1
View File
@@ -0,0 +1 @@
content from file users.php