Giter Club home page Giter Club logo

kompose's Introduction

Kompose (Kubernetes + Compose)

Build Status Widget Coverage Status Widget GoDoc Widget GoReportCard Widget

logo

kompose is a tool to help users who are familiar with docker-compose move to Kubernetes. kompose takes a Compose Specification file and translates it into Kubernetes resources.

kompose is a convenience tool to go from local Compose environment to managing your application with Kubernetes. Transformation of the Compose Specification format to Kubernetes resources manifest may not be exact, but it helps tremendously when first deploying an application on Kubernetes.

Use Case

Convert compose.yaml into Kubernetes deployments and services with one simple command:

$ kompose convert -f compose.yaml
INFO Kubernetes file "frontend-service.yaml" created
INFO Kubernetes file "redis-leader-service.yaml" created
INFO Kubernetes file "redis-replica-service.yaml" created
INFO Kubernetes file "frontend-deployment.yaml" created
INFO Kubernetes file "redis-leader-deployment.yaml" created
INFO Kubernetes file "redis-replica-deployment.yaml" created

Other examples are provided in the examples directory.

Installation

We have multiple ways to install Kompose. Our preferred method is downloading the binary from the latest GitHub release.

Our entire list of installation methods are located in our installation.md document.

Installation methods:

Binary installation

Kompose is released via GitHub on a three-week cycle, you can see all current releases on the GitHub release page.

Linux and macOS:

# Linux
curl -L https://github.com/kubernetes/kompose/releases/download/v1.33.0/kompose-linux-amd64 -o kompose

# macOS
curl -L https://github.com/kubernetes/kompose/releases/download/v1.33.0/kompose-darwin-amd64 -o kompose

chmod +x kompose
sudo mv ./kompose /usr/local/bin/kompose

Windows:

Download from GitHub and add the binary to your PATH.

Shell autocompletion

We support Bash, Zsh and Fish autocompletion.

# Bash (add to .bashrc for persistence)
source <(kompose completion bash)

# Zsh (add to .zshrc for persistence)
source <(kompose completion zsh)

# Fish autocompletion
kompose completion fish | source

Development and building of Kompose

Building with go

Requisites:

  1. make
  2. Golang v1.6 or later
  3. Set GOPATH correctly or click SettingGOPATH for details

Steps:

  1. Clone repository
$ git clone https://github.com/kubernetes/kompose.git $GOPATH/src/github.com/kubernetes/kompose
  1. Change directory to the cloned repo.
cd $GOPATH/src/github.com/kubernetes/kompose
  1. Build with make
$ make bin
  1. Or build with go
$ go build -o kompose main.go
  1. Test your changes
$ make test

Documentation

Documentation can be found at our kompose.io website or our docs folder.

Here is a list of all available docs:

Community, Discussion, Contribution, and Support

Issues: If you find any issues, please file it.

Kubernetes Community: As part of the Kubernetes ecosystem, we follow the Kubernetes community principles. More information can be found on the community page.

Chat (Slack): We're fairly active on Slack and you can find us in the #kompose channel.

Code of Conduct

Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.

kompose's People

Contributors

adamdang avatar ahmedgrati avatar ashetty1 avatar asifdxtreme avatar axel7083 avatar cab105 avatar cdrage avatar concaf avatar dependabot[bot] avatar dustymabe avatar hangyan avatar janetkuo avatar k8s-ci-robot avatar kadel avatar kundan2707 avatar lctrs avatar lexcao avatar martinjirku avatar namusyaka avatar ngtuna avatar procrypt avatar realgam3 avatar rtnpro avatar sbs2001 avatar sebgoa avatar sosan avatar surajnarwade avatar surajssd avatar tessaio avatar xianlubird avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kompose's Issues

[Discuss] Optimize convert function

In order to support different types of input format (dab, compose v1, compose v2, etc) and break down the convert function as well, I am thinking about creating a generic struct like this:

type komposeSet struct {
  Image string
  Name  string
  Volume  []Volumes
  Network []Networks
  Environment []string
  Port  []Ports
  Command string
}

I will think more on mandatory fields need to be declared of this struct.

Idea behind is that we take file from different input, build corresponding parsing function to map it to komposeSet struct. Then the main convert function will only do the transformation from komposeSet to k8s controllers and service. With that strategy, we also can cut-off the dependency on libcompose's structs between versions.

Thought ?

Decide status of skippbox/kompose

Now that things are cleaner with kompose2 , shall we just remove github/kompose and rename this repo to kompose ?

I don't really see the need to keep the original fork of lib compose.

Write an architecture document for kompose

Kompose is getting a lot of traction. Would be a nice thing to have an architecture document that will help document kompose internals and also help new contributors to get ramped up.

Release process

Follow up #64 (comment):

In the release note we can provide checksums and installation guide, something like this:

Installation

Linux

curl -Lo kompose https://github.com/skippbox/kompose/releases/download/v0.0.1-beta.1/kompose_linux-amd64 && chmod +x kompose && sudo mv kompose /usr/local/bin/

Checksums

Linux

$ openssl sha1 /usr/local/bin/kompose
SHA1(/usr/local/bin/kompose)= 826c247a4bdca44d2b68bef48d6649dd86813ef2

We should have a release process (or did I miss it?)

docker-compose service with no ports is mapped to k8s svc with no ports

When a docker-compose service is given with no ports, a corresponding k8s service is created with no port info, and this is wrong config, because port is required value.

docker-compose.yml file I used.

$ cat docker-compose-no-ports.yml 
  mariadb:
    image: centos/mariadb
    environment:
      MYSQL_ROOT_PASSWORD: etherpad
      MYSQL_DATABASE: etherpad
      MYSQL_PASSWORD: etherpad
      MYSQL_USER: etherpad

convert

$ ./kompose convert -f docker-compose-no-ports.yml -o output -y
file "output" created
$ cat output 
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    service: mariadb
  name: mariadb
spec:
  ports: []
  selector:
    service: mariadb
status:
  loadBalancer: {}

---
[SNIP]

When this definition is fed to kubernetes it says:

$ kubectl create -f svc 
The Service "mariadb" is invalid.
spec.ports: Required value

Where svc is:

$ cat svc 
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    service: mariadb
  name: mariadb
spec:
  ports: []
  selector:
    service: mariadb
status:
  loadBalancer: {}

IMO this should error out or should not create service, give warning loud and clear that service is not created, but still we can have deployment or ReplicationController depending on the provider(k8s/openshift).

Breaking code in app.go to multiple packags

What if we would break app.go to multiple packages?

I suggest creating notion of loaders and transformers.
Loader would load input file and convert it to komposeObject.
Transformer would convert komposeObject to target format.
Every loader and every transformer would live in its own package.

pkg/loader/dockercompose/
pkg/loader/boundlefile/

pkg/transformer/kubernetes/
pkg/transformer/openshift/

It could look like this:

                  +------+          +-----------+
input file -----> |loader|          |transformer| -----> output files
                  +------+          +-----------+
                     |                    ^
                     |                    |
                     |                    |
                     +--> komposeObject --+

Idea: kompose up, ps, delete, scale redirect to kubectl

kompose up, ps, delete, scale are duplicate of kubectl, but are easier to learn from compose users perspective.

How about we suggest users the right kubectl command for each kompose command so that we don't need to reinvent the wheel? Something like:

$ kompose up
To initiate your compose services, run "kubectl create -f web-rc.json -f web-svc.json".

Thoughts?

Bug: chart only expect .json files

This example in README doesn't work since it expects only .json files

$ ./kompose convert -c -y
file "redis-rc.yaml" created
file "web-rc.yaml" created
file "redis-svc.yaml" created
file "web-svc.yaml" created
INFO[0000] Error reading redis-rc.yaml: open redis-rc.json: no such file or directory

FATA[0000] Failed to create Chart data: open redis-rc.json: no such file or directory

We should support -c -y.

Should we support -c -o? Should we support -c -dc (copy template files of other types of controller) and -c -dc -rs (multiple types of contollers)?

if random docker-compose file is not present --file option does not work

I found out, that even though we use the --file option, we still need to have a somewhat valid docker-compose file present.

sebair: kompose2 (master)$ cat docker-compose.yml 
toto:
  image: toto
sebair: kompose2 (master)$ cat mongo.yml 
mongo:
  image: mongo
sebair: kompose2 (master)$ ./kompose convert -f mongo.yml --stdout
{
  "kind": "ReplicationController",
  "apiVersion": "v1",
  "metadata": {
    "name": "mongo",
    "creationTimestamp": null,
    "labels": {
      "service": "mongo"

if you remove the docker-compose file:

$ ./kompose convert -f mongo.yml --stdout
ERRO[0000] Failed to find docker-compose.yml            
FATA[0000] Failed to read project: open docker-compose.yml: no such file or directory 

panic: runtime error: invalid memory address or nil pointer dereference

Tried with v0.0.1-beta.1:

$ kompose convert -f docker-compose.yml -y
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x64c354]

goroutine 1 [running]:
panic(0x11e6760, 0xc820012110)
    /usr/local/go/src/runtime/panic.go:464 +0x3e6
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.Interpolate.func1(0xc820273df0, 0xf, 0x0, 0x0)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:145 +0x84
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.parseVariableWithBraces(0xc82018e240, 0x24, 0x11, 0xc8204cfbf8, 0x0, 0x0, 0x0, 0xc82044a0e0)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:53 +0x14c
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.parseInterpolationExpression(0xc82018e240, 0x24, 0x1, 0xc8204cfbf8, 0x0, 0x0, 0x3113, 0x410d38)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:71 +0x9b
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.parseLine(0xc82018e240, 0x24, 0xc8204cfbf8, 0x0, 0x0, 0x134d001)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:90 +0xbf
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.parseConfig(0xc8202c1b80, 0x5, 0xc8202c1b60, 0xc, 0xc8204cfb78, 0xc8204cfbf8, 0x0, 0x0)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:110 +0x532
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.Interpolate(0x0, 0x0, 0xc8204cfd48, 0x0, 0x0)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:144 +0x1c4
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.MergeServicesV2(0xc820459840, 0x0, 0x0, 0x0, 0x0, 0xc820459820, 0x12, 0xc8203f7500, 0x3113, 0x3313, ...)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/merge_v2.go:22 +0x12a
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.Merge(0xc820459840, 0x0, 0x0, 0x0, 0x0, 0xc820459820, 0x12, 0xc8203f7500, 0x3113, 0x3313, ...)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/merge.go:40 +0x24c
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/project.(*Project).load(0xc82045ad00, 0xc820459820, 0x12, 0xc8203f7500, 0x3113, 0x3313, 0x0, 0x0)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/project/project.go:178 +0xe5
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/project.(*Project).Parse(0xc82045ad00, 0x0, 0x0)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/project/project.go:86 +0x335
github.com/skippbox/kompose/cli/app.loadComposeFile(0xc820459820, 0x12, 0xc820349180, 0x0)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/cli/app/app.go:733 +0x1b6
github.com/skippbox/kompose/cli/app.Convert(0xc820349180)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/cli/app/app.go:1028 +0x4b9
github.com/skippbox/kompose/cli/command.ConvertCommand.func1(0xc820349180)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/cli/command/command.go:30 +0x21
github.com/skippbox/kompose/vendor/github.com/urfave/cli.Command.Run(0x13e2208, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1593620, 0x30, 0x0, ...)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/urfave/cli/command.go:179 +0x1399
github.com/skippbox/kompose/vendor/github.com/urfave/cli.(*App).Run(0xc8204806e0, 0xc82000a0f0, 0x5, 0x5, 0x0, 0x0)
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/vendor/github.com/urfave/cli/app.go:196 +0x137c
main.main()
    /Users/sebastiengoasguen/Documents/go/src/github.com/skippbox/kompose/cli/main/main.go:46 +0x5fe

`targetPort` is 0 in a converted service definition

targetPort is 0 in a service

When doing the conversion, if a port is defined as "3306" it sets the service's port as 3306 but sets targetPort as 0. This artifact works with k8s, when deployed, but the concern is of wrong/misleading info, generated. We can do a thing if a port is given as X set X as both port and targetPort. But if port given as X:Y we can set targetPort as Y and port as X.

I am using docker-compose.yml as:

$ cat docker-compose.yml
version: "2"

services:
  mariadb:
    image: centos/mariadb
    ports:
      - "3306"
    environment:
      MYSQL_ROOT_PASSWORD: etherpad
      MYSQL_DATABASE: etherpad
      MYSQL_PASSWORD: etherpad
      MYSQL_USER: etherpad

convert:

$ ./kompose convert  -o output -y
file "output" created

wrong output

$ cat output 
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    service: mariadb
  name: mariadb
spec:
  ports:
  - name: "3306"
    port: 3306
    protocol: TCP
    targetPort: 0
  selector:
    service: mariadb
status:
  loadBalancer: {}

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    service: mariadb
  name: mariadb
spec:
  replicas: 1
  selector:
    matchLabels:
      service: mariadb
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        service: mariadb
    spec:
      containers:
      - env:
        - name: MYSQL_USER
          value: etherpad
        - name: MYSQL_DATABASE
          value: etherpad
        - name: MYSQL_PASSWORD
          value: etherpad
        - name: MYSQL_ROOT_PASSWORD
          value: etherpad
        image: centos/mariadb
        name: mariadb
        ports:
        - containerPort: 3306
          protocol: TCP
        resources: {}
      restartPolicy: Always
status: {}

---

Redundant file creation message

$ ../kompose convert 
file abc.yaml has been created
file abc.yaml has been created
file abc.yaml has been created
file abc.yaml has been created

I'll send a PR for this.

Support k8s 1.3

Upgrade k8s dependency to v1.3, support to post k8s objects to 1.3 endpoint

Environment Variable substitution not working

I am using following docker-compose.yml file

$ cat docker-compose.yml 
version: "2"

services:
  mariadb:
    image: centos/mariadb
    ports:
      - "$DB_PORT"
    environment:
      MYSQL_ROOT_PASSWORD: $ROOT_PASS
      MYSQL_DATABASE: $DB_NAME
      MYSQL_PASSWORD: $DB_PASS
      MYSQL_USER: $DB_USER

  etherpad:
    image: centos/etherpad
    ports:
      - "80:9001"
    depends_on:
      - mariadb
    environment:
      DB_HOST: $DB_HOST
      DB_DBID: $DB_NAME
      DB_PASS: $DB_PASS
      DB_PORT: $DB_PORT
      DB_USER: $DB_USER

and following envs

$ cat envs 
DB_HOST=mariadb
ROOT_PASS=etherpad
DB_NAME=etherpad
DB_PASS=etherpad
DB_USER=etherpad
DB_PORT=3306

error

$ export $(cat envs)
$ ./kompose convert -o output
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x64e144]

goroutine 1 [running]:
panic(0x11ef080, 0xc820010140)
    /usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.Interpolate.func1(0xc8204acc88, 0x7, 0x0, 0x0)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:145 +0x84
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.parseVariable(0xc8204ac790, 0x8, 0x8, 0xc82015fbe8, 0x0, 0x0, 0x0, 0xc8204ba150)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:36 +0x120
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.parseInterpolationExpression(0xc8204ac790, 0x8, 0x1, 0xc82015fbe8, 0x0, 0x0, 0xc82015f7a8, 0x4127d8)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:74 +0x10f
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.parseLine(0xc8204ac790, 0x8, 0xc82015fbe8, 0x0, 0x0, 0x412672)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:90 +0xbf
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.parseConfig(0xc8204ac718, 0x5, 0xc8204ac6f0, 0x7, 0xc82015f990, 0xc82015fbe8, 0x0, 0x0)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:110 +0x532
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.parseConfig(0xc8204ac718, 0x5, 0xc8204ac6f0, 0x7, 0xc82015fb68, 0xc82015fbe8, 0x0, 0x0)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:117 +0x1d3
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.Interpolate(0x0, 0x0, 0xc82015fd38, 0x0, 0x0)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/interpolation.go:144 +0x1f3
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.MergeServicesV2(0xc8204638c0, 0x0, 0x0, 0x0, 0x0, 0xc820463880, 0x12, 0xc82049c000, 0x1d9, 0x3d9, ...)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/merge_v2.go:22 +0x12a
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config.Merge(0xc8204638c0, 0x0, 0x0, 0x0, 0x0, 0xc820463880, 0x12, 0xc82049c000, 0x1d9, 0x3d9, ...)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/config/merge.go:40 +0x24c
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/project.(*Project).load(0xc8204651e0, 0xc820463880, 0x12, 0xc82049c000, 0x1d9, 0x3d9, 0x0, 0x0)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/project/project.go:178 +0xe5
github.com/skippbox/kompose/vendor/github.com/docker/libcompose/project.(*Project).Parse(0xc8204651e0, 0x0, 0x0)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/docker/libcompose/project/project.go:86 +0x335
github.com/skippbox/kompose/cli/app.loadComposeFile(0xc820463880, 0x12, 0xc820347180, 0x0)
    /home/vagrant/work/src/github.com/skippbox/kompose/cli/app/app.go:733 +0x1b6
github.com/skippbox/kompose/cli/app.Convert(0xc820347180)
    /home/vagrant/work/src/github.com/skippbox/kompose/cli/app/app.go:1028 +0x4b9
github.com/skippbox/kompose/cli/command.ConvertCommand.func1(0xc820347180)
    /home/vagrant/work/src/github.com/skippbox/kompose/cli/command/command.go:30 +0x21
github.com/skippbox/kompose/vendor/github.com/urfave/cli.Command.Run(0x13eb378, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x159d920, 0x30, 0x0, ...)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/urfave/cli/command.go:179 +0x1399
github.com/skippbox/kompose/vendor/github.com/urfave/cli.(*App).Run(0xc82048ab00, 0xc82000a940, 0x4, 0x4, 0x0, 0x0)
    /home/vagrant/work/src/github.com/skippbox/kompose/vendor/github.com/urfave/cli/app.go:196 +0x137c
main.main()
    /home/vagrant/work/src/github.com/skippbox/kompose/cli/main/main.go:46 +0x5fe

version

$ ./kompose -v
kompose version 0.0.1-alpha (HEAD)

`depends_on` is not supported

I am using following docker-compose.yml and when running it errors out saying depends_on not supported.

$ cat docker-compose.yml
  mariadb:
    image: centos/mariadb
    ports:
      - "3306"
    environment:
      MYSQL_ROOT_PASSWORD: etherpad
      MYSQL_DATABASE: etherpad
      MYSQL_PASSWORD: etherpad
      MYSQL_USER: etherpad

  etherpad:
    build: "./myphp"
    ports:
      - "80:9001"
    depends_on:
      - mariadb
    environment:
      DB_HOST: mariadb
      DB_DBID: etherpad
      DB_PASS: etherpad
      DB_USER: etherpad

running it

$ ./kompose convert -o output
ERRO[0000] Could not parse config for project etherpad : Unsupported config option for etherpad service: 'depends_on' 
FATA[0000] Failed to load compose file%!(EXTRA *errors.errorString=Unsupported config option for etherpad service: 'depends_on') 

convert file fail

i've just use "kompose convert" from an docker-compose.yaml file to new file yml of k8s, but it went wrong, and show me the error:
"ERRO[0000] Failed to unmarshall: Cannot unmarshal '30' of type int64 into a string value"

Is this new issue? Or i did wrong?

@ngtuna

Consider changing `--rc` flag to bool and adding `--replicas`

Right now all flags for specifying controller types are bool, except for --rc, which is int.

This is confusing because I cannot do this

$ ../kompose convert --rc -y
Incorrect Usage.

And this (surprisingly) gives me a deployment

$ ../kompose convert --rc="0" -y
file "redis-svc.yaml" created
file "web-svc.yaml" created
file "redis-deployment.yaml" created
file "web-deployment.yaml" created

I propose that we change --rc back to bool and add another int flag for specifying replicas, since other controllers also take replicas in their spec. We can default it to -1 as unset, and then we don't specify it in spec (and let K8s API server decide the default value). If it's set to something >= 0, we set it explicitly.

Add OpenShift support

We would like to contribute OpenShift support to kompose2.
In core OpenShift is basically Kubernetes with some additional objects like BuildConfig, DeploymentConfig, ImageStream or Route.
With BuildConfig OpenShift can even support docker-compose build directive.

I guess that this first design question would be how command line is going to look like.
What if we use provider (orchestration tool) name as command and actions as subcommands?
Examples how it would look like:

kompose kubernetes convert
kompose kubernetes up

kompose openshift convert
kompose openshift up

When we do it like this, than in future different providers could even have different actions.

Unable to go build

$ go build -o kompose ./cli/main/
cli/app/app.go:29:2: no buildable Go source files in go/src/github.com/skippbox/kompose/vendor/github.com/docker/docker/api/client/bundlefile

This is because of a recent change to vendor/github.com/docker/docker/api/client/bundlefile/bundlefile.go:

// +build experimental

package bundlefile

Build error went away after removing // +build experimental.

cc @kadel

Document unsupported fileds

with warnings now given for unsupported fields.
It might be good to document it a bit:

$ cat nginx.yml 
nginx:
  image: nginx
  dockerfile: "1"
  build: ./foobar
  cap_add:
    - foobar
  container_name: foobar
$ ./kompose convert -f nginx.yml
WARNING: Unsupported key Build - ignoring
WARNING: Unsupported key CapAdd - ignoring
WARNING: Unsupported key ContainerName - ignoring
WARNING: Unsupported key Dockerfile - ignoring

Default controller object is always generated.

Right now default controller is always generated.
When I do kompose convert --replicaset I get Services, Deployments and ReplicaSets.
I think that this is little bit confusing (even if they are in different files).
When I run above command I would expect only Services and ReplicaSets. In most cases you need only one controller object.

When I do kompose convert --replicaset --deployment than I would expect both (ReplicaSets and Deployments)

Should we support converting to Replica Sets?

Since we discourage people from using Replica Sets directly (instead they should use Deployments), how about removing the support for converting to RS? On the other hand, converting to Replication Controllers makes sense for people haven't adopted Deployments.

[Discuss] Find a good way to vendoring dependencies

Guys,

The current issue I am facing in kompose is finding a good solution to vendoring dependencies. As you know, kompose refers to some structs of libcompose and kubernetes in order to do mapping fields between them. While kompose depends on libcompose and kubernetes, both of them are sharing lot of common dependencies but with different revisions. The current code base is quite stable, but let's say now I have to upgrade libcompose revision in order to solve #11 and #4 (which I also have to upgrade docker/docker revision in order to get bundlefile struct), also in future we have to support k8s 1.4, 1.5, etc.

vendoring seems to be a hot issue to be discussed at GopherCon afaik...

Someone introduces me https://github.com/sdboyer/gps. I will take a look on it tomorrow.

Any idea?

Sometimes redundant services are printed/converted in `kompose convert`

Note that there's a redundant file "web-svc.json" created message.

examples(master)$ ../kompose convert 
file "web-rc.json" created
file "web-svc.json" created
file "redis-rc.json" created
file "web-svc.json" created
file "redis-svc.json" createdexamples(master)$ ../kompose convert 
file "redis-rc.json" created
file "web-rc.json" created
file "redis-svc.json" created
file "web-svc.json" created

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.