forked from LaconicNetwork/kompose
Add new examples to kompose (#1803)
#### What type of PR is this? <!-- Add one of the following kinds: /kind bug /kind documentation /kind feature --> /kind cleanup #### What this PR does / why we need it: Fixes the current broken examples by: * Removing all the old incompatible ones (we do not really support v3 anymore or v2... since switching libraries) * Uses quay.io/kompose/web as our front end example which is a fork of the guestbook-go kubernetes examples #### Which issue(s) this PR fixes: <!-- *Automatically closes linked issue when PR is merged. Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> Closes https://github.com/kubernetes/kompose/issues/1757 #### Special notes for your reviewer: Test using docker-compose (you'll see it come up!), then try with kompose :) Signed-off-by: Charlie Drage <charlie@charliedrage.com>
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ redirect_from:
|
||||
* TOC
|
||||
{:toc}
|
||||
|
||||
This document outlines all possible conversion details regarding `docker-compose.yaml` values to Kubernetes / OpenShift artifacts.
|
||||
This document outlines all possible conversion details regarding `compose.yaml` values to Kubernetes / OpenShift artifacts.
|
||||
|
||||
## Version Support
|
||||
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ Currently, it is not possible to use a different Kubernetes version from the ver
|
||||
|
||||
### Adding CLI tests
|
||||
|
||||
[Kompose CLI tests](https://github.com/kubernetes/kompose/tree/main/script/test/cmd) run `kompose convert` with docker-compose files, and cross-check the k8s and OpenShift artifacts generated with the template files.
|
||||
[Kompose CLI tests](https://github.com/kubernetes/kompose/tree/main/script/test/cmd) run `kompose convert` with compose files, and cross-check the k8s and OpenShift artifacts generated with the template files.
|
||||
|
||||
To generate CLI tests, please run `make gen-cmd`.
|
||||
|
||||
|
||||
+12
-12
@@ -20,7 +20,7 @@ For beginners and the most compatibility, follow the _Minikube and Kompose_ guid
|
||||
|
||||
## Minikube and Kompose
|
||||
|
||||
In this guide, we'll deploy a sample `docker-compose.yaml` file to a Kubernetes cluster.
|
||||
In this guide, we'll deploy a sample `compose.yaml` file to a Kubernetes cluster.
|
||||
|
||||
Requirements:
|
||||
|
||||
@@ -44,15 +44,15 @@ Starting cluster components...
|
||||
Kubectl is now configured to use the cluster
|
||||
```
|
||||
|
||||
**Download an [example Docker Compose file](https://raw.githubusercontent.com/kubernetes/kompose/main/examples/docker-compose.yaml), or use your own:**
|
||||
**Download an [example Docker Compose file](https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml), or use your own:**
|
||||
|
||||
```sh
|
||||
wget https://raw.githubusercontent.com/kubernetes/kompose/main/examples/docker-compose.yaml
|
||||
wget https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml
|
||||
```
|
||||
|
||||
**Convert your Docker Compose file to Kubernetes:**
|
||||
|
||||
Run `kompose convert` in the same directory as your `docker-compose.yaml` file.
|
||||
Run `kompose convert` in the same directory as your `compose.yaml` file.
|
||||
|
||||
```sh
|
||||
$ kompose convert
|
||||
@@ -110,7 +110,7 @@ $ curl http://123.45.67.89
|
||||
|
||||
## Minishift and Kompose
|
||||
|
||||
In this guide, we'll deploy a sample `docker-compose.yaml` file to an OpenShift cluster.
|
||||
In this guide, we'll deploy a sample `compose.yaml` file to an OpenShift cluster.
|
||||
|
||||
Requirements:
|
||||
|
||||
@@ -134,15 +134,15 @@ Starting local OpenShift cluster using 'kvm' hypervisor...
|
||||
...
|
||||
```
|
||||
|
||||
**Download an [example Docker Compose file](https://raw.githubusercontent.com/kubernetes/kompose/main/examples/docker-compose.yaml), or use your own:**
|
||||
**Download an [example Docker Compose file](https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml), or use your own:**
|
||||
|
||||
```sh
|
||||
wget https://raw.githubusercontent.com/kubernetes/kompose/main/examples/docker-compose.yaml
|
||||
wget https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml
|
||||
```
|
||||
|
||||
**Convert your Docker Compose file to OpenShift:**
|
||||
|
||||
Run `kompose convert --provider=openshift` in the same directory as your `docker-compose.yaml` file.
|
||||
Run `kompose convert --provider=openshift` in the same directory as your `compose.yaml` file.
|
||||
|
||||
```sh
|
||||
$ kompose convert --provider=openshift
|
||||
@@ -188,7 +188,7 @@ Opening the OpenShift Web console in the default browser...
|
||||
|
||||
## RHEL and Kompose
|
||||
|
||||
In this guide, we'll deploy a sample `docker-compose.yaml` file using both RHEL (Red Hat Enterprise Linux) and OpenShift.
|
||||
In this guide, we'll deploy a sample `compose.yaml` file using both RHEL (Red Hat Enterprise Linux) and OpenShift.
|
||||
|
||||
Requirements:
|
||||
|
||||
@@ -254,15 +254,15 @@ Starting local OpenShift cluster using 'kvm' hypervisor...
|
||||
...
|
||||
```
|
||||
|
||||
**Download an [example Docker Compose file](https://raw.githubusercontent.com/kubernetes/kompose/main/examples/docker-compose.yaml), or use your own:**
|
||||
**Download an [example Docker Compose file](https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml), or use your own:**
|
||||
|
||||
```sh
|
||||
wget https://raw.githubusercontent.com/kubernetes/kompose/main/examples/docker-compose.yaml
|
||||
wget https://raw.githubusercontent.com/kubernetes/kompose/main/examples/compose.yaml
|
||||
```
|
||||
|
||||
**Convert your Docker Compose file to OpenShift:**
|
||||
|
||||
Run `kompose convert --provider=openshift` in the same directory as your `docker-compose.yaml` file.
|
||||
Run `kompose convert --provider=openshift` in the same directory as your `compose.yaml` file.
|
||||
|
||||
```sh
|
||||
$ kompose convert --provider=openshift
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ layout: index
|
||||
---
|
||||
|
||||
```sh
|
||||
$ kompose convert -f docker-compose.yaml
|
||||
$ kompose convert -f compose.yaml
|
||||
|
||||
$ kubectl apply -f .
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ There are some projects out there known to use Kompose integrated in some form o
|
||||
|
||||
### Kompose Docker Container by Cloudfind
|
||||
|
||||
**Description:** "A Docker container for the Kompose translator for docker-compose"
|
||||
**Description:** "A Docker container for the Kompose translator for compose"
|
||||
|
||||
**Link:** [https://github.com/cloudfind/kompose-docker](https://github.com/cloudfind/kompose-docker)
|
||||
|
||||
@@ -49,9 +49,9 @@ There are some projects out there known to use Kompose integrated in some form o
|
||||
**Description:** "Maven is one of the widely used build tools for Java applications. The Fabric8 Maven Plugin is a maven extension that simplifies the deployment of Java applications to Kubernetes or OpenShift clusters.
|
||||
The main task of this plugin is to build Docker images, generate Kubernetes or OpenShift resource descriptors and run/deploy the application on Kubernetes or OpenShift cluster.
|
||||
The plugin has a wide range of configuration options. Docker Compose is one of the options to bring up deployments on Kubernetes or OpenShift clusters.
|
||||
Technically, Fabric8 Maven Plugin processes the external docker-compose.yml file and generates Kubernetes or OpenShift resources via Kompose."
|
||||
Technically, Fabric8 Maven Plugin processes the external compose.yml file and generates Kubernetes or OpenShift resources via Kompose."
|
||||
|
||||
**Links:**
|
||||
|
||||
* [Quickstart](/maven-example)
|
||||
* [Documentation](https://maven.fabric8.io/#docker-compose)
|
||||
* [Documentation](https://maven.fabric8.io/#compose)
|
||||
|
||||
@@ -87,20 +87,20 @@ Now that your service has been deployed, let's access it by querying `pod`, `ser
|
||||
```bash
|
||||
$ oc get pods
|
||||
NAME READY STATUS RESTARTS AGE
|
||||
springboot-docker-compose-1-xl0vb 1/1 Running 0 5m
|
||||
springboot-docker-compose-s2i-1-build 0/1 Completed 0 7m
|
||||
springboot-compose-1-xl0vb 1/1 Running 0 5m
|
||||
springboot-compose-s2i-1-build 0/1 Completed 0 7m
|
||||
```
|
||||
|
||||
```bash
|
||||
$ oc get svc
|
||||
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||
springboot-docker-compose 172.30.205.137 <none> 8080/TCP 6m
|
||||
springboot-compose 172.30.205.137 <none> 8080/TCP 6m
|
||||
```
|
||||
|
||||
Let's access the Springboot service.
|
||||
|
||||
```bash
|
||||
$ minishift openshift service --in-browser springboot-docker-compose
|
||||
$ minishift openshift service --in-browser springboot-compose
|
||||
Created the new window in existing browser session.
|
||||
```
|
||||
|
||||
|
||||
+16
-18
@@ -37,14 +37,14 @@ INFO Kubernetes file "worker-deployment.yaml" created
|
||||
INFO Kubernetes file "db-deployment.yaml" created
|
||||
|
||||
$ ls
|
||||
db-deployment.yaml docker-compose.yml docker-gitlab.yml redis-deployment.yaml result-deployment.yaml vote-deployment.yaml worker-deployment.yaml
|
||||
db-deployment.yaml compose.yml docker-gitlab.yml redis-deployment.yaml result-deployment.yaml vote-deployment.yaml worker-deployment.yaml
|
||||
db-svc.yaml docker-voting.yml redis-svc.yaml result-svc.yaml vote-svc.yaml worker-svc.yaml
|
||||
```
|
||||
|
||||
You can also provide multiple docker-compose files at the same time:
|
||||
You can also provide multiple compose files at the same time:
|
||||
|
||||
```sh
|
||||
$ kompose -f docker-compose.yml -f docker-guestbook.yml convert
|
||||
$ kompose -f compose.yml -f docker-guestbook.yml convert
|
||||
INFO Kubernetes file "frontend-service.yaml" created
|
||||
INFO Kubernetes file "mlbparks-service.yaml" created
|
||||
INFO Kubernetes file "mongodb-service.yaml" created
|
||||
@@ -64,11 +64,11 @@ frontend-service.yaml mongodb-deployment.yaml redis-repli
|
||||
redis-master-deployment.yaml
|
||||
```
|
||||
|
||||
When multiple docker-compose files are provided the configuration is merged. Any configuration that is common will be over ridden by subsequent file.
|
||||
When multiple compose files are provided the configuration is merged. Any configuration that is common will be over ridden by subsequent file.
|
||||
|
||||
You can provide your docker-compose files via environment variables as following:
|
||||
You can provide your compose files via environment variables as following:
|
||||
```sh
|
||||
$ COMPOSE_FILE="docker-compose.yaml alternative-docker-compose.yaml" kompose convert
|
||||
$ COMPOSE_FILE="compose.yaml alternative-compose.yaml" kompose convert
|
||||
```
|
||||
|
||||
### OpenShift
|
||||
@@ -95,7 +95,7 @@ INFO OpenShift file "result-imagestream.yaml" created
|
||||
It also supports creating buildconfig for build directive in a service. By default, it uses the remote repository for the current git branch as the source repository, and the current branch as the source branch for the build. You can specify a different source repository and branch using `--build-repo` and `--build-branch` options respectively.
|
||||
|
||||
```sh
|
||||
$ kompose --provider openshift --file buildconfig/docker-compose.yml convert
|
||||
$ kompose --provider openshift --file buildconfig/compose.yml convert
|
||||
WARN [foo] Service cannot be created because of missing port.
|
||||
INFO OpenShift Buildconfig using git@github.com:rtnpro/kompose.git::master as source.
|
||||
INFO OpenShift file "foo-deploymentconfig.yaml" created
|
||||
@@ -157,10 +157,10 @@ INFO Kubernetes file "web-svc.yaml" created
|
||||
INFO Kubernetes file "redis-svc.yaml" created
|
||||
INFO Kubernetes file "web-deployment.yaml" created
|
||||
INFO Kubernetes file "redis-deployment.yaml" created
|
||||
chart created in "./docker-compose/"
|
||||
chart created in "./compose/"
|
||||
|
||||
$ tree docker-compose/
|
||||
docker-compose
|
||||
$ tree compose/
|
||||
compose
|
||||
├── Chart.yaml
|
||||
├── README.md
|
||||
└── templates
|
||||
@@ -174,7 +174,7 @@ The chart structure is aimed at providing a skeleton for building your Helm char
|
||||
|
||||
## Labels
|
||||
|
||||
`kompose` supports Kompose-specific labels within the `docker-compose.yml` file to
|
||||
`kompose` supports Kompose-specific labels within the `compose.yml` file to
|
||||
explicitly define the generated resources' behavior upon conversion, like Service, PersistentVolumeClaim...
|
||||
|
||||
The currently supported options are:
|
||||
@@ -428,11 +428,9 @@ version: "3.3"
|
||||
|
||||
services:
|
||||
front-end:
|
||||
image: gcr.io/google-samples/gb-frontend:v4
|
||||
environment:
|
||||
- GET_HOSTS_FROM=dns
|
||||
image: quay.io/kompose/web
|
||||
ports:
|
||||
- 80:80
|
||||
- 8080:8080
|
||||
labels:
|
||||
kompose.service.expose: lb
|
||||
kompose.service.external-traffic-policy: local
|
||||
@@ -468,9 +466,9 @@ services:
|
||||
```
|
||||
## Restart
|
||||
|
||||
If you want to create normal pods without controller you can use `restart` construct of docker-compose to define that. Follow table below to see what happens on the `restart` value.
|
||||
If you want to create normal pods without controller you can use `restart` construct of compose to define that. Follow table below to see what happens on the `restart` value.
|
||||
|
||||
| `docker-compose` `restart` | object created | Pod `restartPolicy` |
|
||||
| `compose` `restart` | object created | Pod `restartPolicy` |
|
||||
| -------------------------- | ----------------- | ------------------- |
|
||||
| `""` | controller object | `Always` |
|
||||
| `always` | controller object | `Always` |
|
||||
@@ -498,7 +496,7 @@ If the Docker Compose file has a volume specified for a service, the Deployment
|
||||
|
||||
If the Docker Compose file has service name with `_` or `.` in it (eg.`web_service` or `web.service`), then it will be replaced by `-` and the service name will be renamed accordingly (eg.`web-service`). Kompose does this because "Kubernetes" doesn't allow `_` in object name.
|
||||
|
||||
Please note that changing service name might break some `docker-compose` files.
|
||||
Please note that changing service name might break some `compose` files.
|
||||
|
||||
## Network policies generation
|
||||
[Network policies](https://kubernetes.io/docs/concepts/services-networking/network-policies) are not generated by default, because it's not mandatory to deploy your application. However, it's one of the best practices when it comes to deploy secure applications on top of Kubernetes.
|
||||
|
||||
Reference in New Issue
Block a user