forked from LaconicNetwork/kompose
Feat support compose files (#1595)
* fix: support host port and protocol in functional tests * feat: support compose.yaml and compose.yml files Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com> * test: implement functional tests of the support of compose files Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com> --------- Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
This commit is contained in:
parent
59d5532181
commit
c2a020eb13
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,6 +7,8 @@ kompose
|
||||
bin
|
||||
/docker-compose.yaml
|
||||
/docker-compose.yml
|
||||
/compose.yaml
|
||||
/compose.yml
|
||||
changes.txt
|
||||
|
||||
# Ignore site documents / when switching branches
|
||||
|
||||
@ -35,10 +35,10 @@ import (
|
||||
var (
|
||||
// DefaultComposeFiles is a list of filenames that kompose will use if no file is explicitly set
|
||||
DefaultComposeFiles = []string{
|
||||
"docker-compose.yml",
|
||||
"compose.yaml",
|
||||
"compose.yml",
|
||||
"docker-compose.yaml",
|
||||
"container-compose.yml",
|
||||
"container-compose.yaml",
|
||||
"docker-compose.yml",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -247,4 +247,8 @@ k8s_output="$KOMPOSE_ROOT/script/test/fixtures/fsgroup/output-k8s.yaml"
|
||||
os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/fsgroup/docker-compose.yaml convert --stdout --with-kompose-annotation=false"
|
||||
os_output="$KOMPOSE_ROOT/script/test/fixtures/fsgroup/output-os.yaml"
|
||||
convert::expect_success_and_warning "$k8s_cmd" "$k8s_output"
|
||||
|
||||
# Test support for compose.yaml file
|
||||
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/compose-file-support convert --stdout --with-kompose-annotation=false"
|
||||
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/compose-file-support/output-k8s.yaml"
|
||||
convert::expect_success "$os_cmd" "$os_output"
|
||||
|
||||
6
script/test/fixtures/compose-file-support/compose.yaml
vendored
Normal file
6
script/test/fixtures/compose-file-support/compose.yaml
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
version: '3'
|
||||
services:
|
||||
web:
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- "80:80"
|
||||
75
script/test/fixtures/compose-file-support/output-k8s.yaml
vendored
Normal file
75
script/test/fixtures/compose-file-support/output-k8s.yaml
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: ./kompose convert --stdout
|
||||
kompose.version: 1.28.0 (4d1ce961)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: web
|
||||
name: web
|
||||
spec:
|
||||
ports:
|
||||
- name: "80"
|
||||
port: 80
|
||||
targetPort: 80
|
||||
selector:
|
||||
io.kompose.service: web
|
||||
status:
|
||||
loadBalancer: {}
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: ./kompose convert --stdout
|
||||
kompose.version: 1.28.0 (4d1ce961)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: web
|
||||
name: web
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
io.kompose.service: web
|
||||
strategy: {}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: ./kompose convert --stdout
|
||||
kompose.version: 1.28.0 (4d1ce961)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.network/kompose-default: "true"
|
||||
io.kompose.service: web
|
||||
spec:
|
||||
containers:
|
||||
- image: nginx:latest
|
||||
name: web
|
||||
ports:
|
||||
- containerPort: 80
|
||||
hostPort: 80
|
||||
protocol: TCP
|
||||
resources: {}
|
||||
restartPolicy: Always
|
||||
status: {}
|
||||
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
name: kompose-default
|
||||
spec:
|
||||
ingress:
|
||||
- from:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
io.kompose.network/kompose-default: "true"
|
||||
podSelector:
|
||||
matchLabels:
|
||||
io.kompose.network/kompose-default: "true"
|
||||
|
||||
5
script/test/fixtures/fsgroup/output-os.yaml
vendored
5
script/test/fixtures/fsgroup/output-os.yaml
vendored
@ -1,5 +1,5 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
apiVersion: apps.openshift.io/v1
|
||||
kind: DeploymentConfig
|
||||
metadata:
|
||||
annotations:
|
||||
@ -61,7 +61,7 @@ status:
|
||||
updatedReplicas: 0
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
apiVersion: image.openshift.io/v1
|
||||
kind: ImageStream
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
@ -99,4 +99,3 @@ spec:
|
||||
requests:
|
||||
storage: 100Mi
|
||||
status: {}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user