diff --git a/.gitignore b/.gitignore index 0248e0b5..9d334104 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ kompose bin /docker-compose.yaml /docker-compose.yml +/compose.yaml +/compose.yml changes.txt # Ignore site documents / when switching branches diff --git a/pkg/app/app.go b/pkg/app/app.go index c7daf2e7..65e600a7 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -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", } ) diff --git a/script/test/cmd/tests_new.sh b/script/test/cmd/tests_new.sh index 80f5415f..5b0a857c 100755 --- a/script/test/cmd/tests_new.sh +++ b/script/test/cmd/tests_new.sh @@ -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" diff --git a/script/test/fixtures/compose-file-support/compose.yaml b/script/test/fixtures/compose-file-support/compose.yaml new file mode 100644 index 00000000..c5562c0c --- /dev/null +++ b/script/test/fixtures/compose-file-support/compose.yaml @@ -0,0 +1,6 @@ +version: '3' +services: + web: + image: nginx:latest + ports: + - "80:80" diff --git a/script/test/fixtures/compose-file-support/output-k8s.yaml b/script/test/fixtures/compose-file-support/output-k8s.yaml new file mode 100644 index 00000000..0c883886 --- /dev/null +++ b/script/test/fixtures/compose-file-support/output-k8s.yaml @@ -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" + diff --git a/script/test/fixtures/fsgroup/output-os.yaml b/script/test/fixtures/fsgroup/output-os.yaml index 50b5eae3..acd7174c 100644 --- a/script/test/fixtures/fsgroup/output-os.yaml +++ b/script/test/fixtures/fsgroup/output-os.yaml @@ -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: {} -