Commit Graph

108 Commits

Author SHA1 Message Date
huikaihoo
d48ae64325 Add label support to named volumes in docker compose v3 to Kubernetes (#1083)
* Support read specific label (kompose.volume.size) from named volume and apply to kubernetes supported volume size

* Fix the PVC size in log message when deploy Kubernetes

* Skip creation of PersistentVolumeClaim if it is already created in the same kubernetes deploy

* Add selector to PersistentVolumeClaim only when specific label (kompose.volume.selector) is used in named volume

* Add test case to named-volume for the new labels
2018-11-29 12:07:17 -05:00
Xianlu Bird
0252213efb Add support for Config, endpoint_mode and 3.3 support (#994)
* Add support for Config

* Add deployment endpoint_mode support

* Add docker compose 3.3 support

* Add compose v3.3 support for openshift
2018-08-01 15:09:00 -04:00
Hang Yan
88b8e316b9 Support hostname and domainname 2018-03-31 12:00:37 +08:00
Oliver Bristow
35a782024d Add kompose.service.expose.tls-secret 2017-12-18 15:56:38 +00:00
Anatoli Babenia
1975c32740 Set service volume size with kompose.volume.size label (#235)
1. Copy labels from compose to kobject
2. If kompose.volume.size is set on service level, use it

Internal API changes:

- Add PVCSize to kobject Volumes struct
- Pass default volume size as CreatePVC() param
2017-11-12 13:05:55 +03:00
Charlie Drage
f4bfe1fcb5 Add env_file + ConfigMaps feature to Kompose
When using env_file with Docker Compose, a ConfigMap will be generated

For example:

```sh
▶ ./kompose convert -f
script/test/fixtures/configmaps/docker-compose.yml
INFO Kubernetes file "redis-service.yaml" created
INFO Kubernetes file "redis-deployment.yaml" created
INFO Kubernetes file "foo-env-configmap.yaml" created
INFO Kubernetes file "bar-env-configmap.yaml" created
```

File:

```yaml
version: '3'

services:
  redis:
    image: 'bitnami/redis:latest'
    environment:
      - ALLOW_EMPTY_PASSWORD=no
    # Env file will override environment / warn!
    env_file:
      - "foo.env"
      - bar.env
    labels:
      kompose.service.type: nodeport
    ports:
      - '6379:6379'
```

To:

```yaml
apiVersion: v1
data:
  ALLOW_EMPTY_PASSWORD: "yes"
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: foo-env
```

```yaml
...
      - env:
        - name: ALLOW_EMPTY_PASSWORD
          valueFrom:
            configMapKeyRef:
              key: ALLOW_EMPTY_PASSWORD
              name: foo-env
```
2017-10-10 12:40:49 -04:00
Suraj Narwade
35198cca12 Added feature for placement key in v3
it will map `engine.labels.operatingsystem` to `beta.kubernetes.io/os` and
`node.hostname` to `kubernetes.io/hostname` and all other constraints will not be supported.
2017-10-06 12:22:14 +05:30
Suraj Narwade
4f8babd623 Added --controller feature
Previously we used to mention controller type as `--deployment`,
`--replication-controller` or `--daemonset` as argument.
But now,
it will be like,

ex.

```
kompose convert --controller=daemonset
```
2017-10-04 12:43:45 +05:30
Charlie Drage
8fddec9e74 Merge pull request #787 from cdrage/refactor-flags
Add --volumes parameter, deprecate emptyvols
2017-09-08 13:08:05 -04:00
Charlie Drage
cc1671aaa9 Add --volumes parameter, deprecate emptyvols
This adds the --volumes paramater with a "generate" and "empty"

By default, "generate" will be used as a place-holder for "true".
Although not used in the code, we will eventually add "none"

This uses CLI paramater naming processes (no emptyVols as that is Go /
Kubernetes specific) and thus we use dashes.
2017-09-05 11:39:57 -04:00
Charlie Drage
2e99b8fd3a Adds healthcheck
This PR adds support for HealthCheck, being able to supply, for example:

```yaml
version: "3"

services:
  redis:
    image: redis
    healthcheck:
      test: echo "hello world"
      interval: 10s
      timeout: 1s
      retries: 5
```

Which is then converted to:

```yaml
spec:
  containers:
  - image: redis
    livenessProbe:
      exec:
        command:
        - echo "hello world"
      failureThreshold: 5
      periodSeconds: 10
      timeoutSeconds: 1
    name: redis
    resources: {}
  restartPolicy: Always
```

At the moment, this only supports livenessProbe, with support for readinessProbe in the future.
2017-08-25 10:02:51 -04:00
Charlie Drage
bd6d493cef Add deploy: mode: global support
Adds support for deploy: mode.

For example:

```yaml
version: "3"

services:
  foo:
    deploy:
      resources:
        mode: global
        replicas: 6
    image: redis
```

Will only generate replicas: 1 in Kubernetes pods as "global" limits
replicas to only one.
2017-08-23 12:47:27 -04:00
Suraj Narwade
641f8f8932 Added support for group_add key
This PR will add support for `group_add` key which will map to
supplemental group in pod security context.
2017-08-10 11:54:35 +05:30
Charlie Drage
09700ca24b Remove bundle references in kobject
Closes https://github.com/kubernetes/kompose/issues/750

Removes references to bundle/dab since we no longer support it.
2017-08-09 11:19:15 -04:00
Charlie Drage
af26b797a2 Add CPU limit, CPU Reservation and Memory Reservation
This adds support for CPU limit, CPU reservation as well as memory
reservation.

Specifically, when using the `deploy` key in Docker Compose.
2017-08-03 09:41:14 -04:00
Suraj Narwade
d5a5f42d8b Handling Volume at early stage
It will resolve #544 as well as refactor volume handling part.
2017-07-26 19:59:05 +05:30
Charlie Drage
b8d64ea336 Merge pull request #677 from cdrage/its-2017
2016 -> 2017 for licensing
2017-07-07 10:10:02 -04:00
Suraj Narwade
041d7f7d61 Added support for replicas keys in v3
resolves #644 `replicas` key
2017-07-04 12:40:12 +05:30
Charlie Drage
ce32bb817d 2016 -> 2017 for licensing
New year, update to the license.
2017-06-28 10:49:52 -04:00
Charlie Drage
e2f9084003 Adds both build and push support
This adds support for building and pushing docker containers
when you perform either `kompose convert` or `kompose up`.

Docker Compose files who have build parameters with their respective
image and build keys will automatically be both built and pushed.
2017-06-14 10:19:12 -04:00
gitlawr
1485ed4479 add support for "pid" key
solve #610
convert service.pid to Pod.Spec.HostPid
set Pod.Spec.HostPid to true if service.pid ="host", to false otherwise
update conversion.md on support for the key
2017-05-31 22:39:17 +08:00
gitlawr
c01f6f1763 To solve #440
This commit Add support for stop_grace_period which maps to
Pod.Spec.TerminationGracePeriodSeconds
Updated conversion.md on support for the key
2017-05-23 12:03:14 +08:00
Suraj Narwade
8fc262bd99 Add build_args support in buildconfig
now args provided under build in docker-compose file can be available in buildconfig.
it solves #406
Added unit test and functional test
solves #445
Separated key:"value" pairs by spaces
2017-05-16 12:19:00 +05:30
Abhishek
f41985a00e Added support for different namespaces
Now we can deploy application in different namespaces using the "--namespace=<value>" flag with kompose up and kompose down. The --namepace flag will deploy the application in that particular "namespace" if exist."
2017-04-12 18:40:32 +05:30
qujinping
3919ad25b5 Support insecure registry and enhance parsing of image stream tag 2017-04-07 10:01:46 +08:00
Suraj Narwade
ec897ef50f Added dockerfile key support
Fixes #486
This commit will add `dockerfilepath` key under Dockerstratergy in buildconfig.
dockerfilepath allow us to use dockerfiles which are named different than `Dockerfile` which are placed in context directory.

for example, for a docker-compose file:

```
version: "2"
services:
    foo:
        build:
            context: "./build"
            dockerfile: "Dockerfile-alternate"
        command: "sleep 3600"
```
Resulting buildconfig will be:

```
apiVersion: v1
kind: BuildConfig
...
...
  strategy:
    dockerStrategy:
      dockerfilePath: Dockerfile-alternate
    type: Docker
...
...
```
2017-03-22 17:49:26 +05:30
Suraj Narwade
494133484c Added support for tmpfs
fixes #436
This commit will add support for tmpfs, configEmptyVolumeSource
function is being modified as it have to work in two ways now.
(For emptyvols and tmpfs)
Added unit test for tmpfs too.
2017-03-16 22:14:39 +05:30
Tomas Kral
b1cb6cdb80
update tags to make go vet 1.8 stop complaining 2017-02-24 15:16:47 +01:00
Charlie Drage
858314e06b Adds mem_limit support for conversion
This commit adds mem_limit support. Taking the value from
docker-compose.yaml and converting it to it's associative value in
Kubernetes artifacts.

Closes (half) of
https://github.com/kubernetes-incubator/kompose/issues/267
2017-02-22 08:19:27 -05:00
Charlie Drage
438088f37d Add support for host:port:port
This adds support for supplying for example:
"127.0.0.1:80:80/tcp" to docker-compose.yaml and converting it to it's
corresponding Kubernetes / OpenShift hostIP.

This commit also refactors the loadPorts function of compose.go

Closes https://github.com/kubernetes-incubator/kompose/issues/335
2017-02-09 12:21:17 -05:00
Abhishek
1ecd32a362 error out if controller object is specified with "restart: on-failure" 2017-01-30 17:52:36 +05:30
Tomas Kral
4f176b847e
fix golint errors 2017-01-05 10:31:11 +01:00
Abhishek
cfcbfa8c6d make default kompose conversion YAML 2017-01-04 12:50:56 +05:30
Abhishek
a5a3805760 added support for multiple-compose files 2017-01-03 17:18:34 +05:30
Ratnadeep Debnath
6f3e670af1 Refactor openshift buildconfig CLI options.
- Remove --buildconfig, -bc option. Create buildconfig if service has build info
- Rename --branch to --build-branch
- Rename --repo to --build-repo
2016-12-28 17:00:33 +05:30
Ratnadeep Debnath
fa724fe12d Allow specifying repo,branch info for buildconfig over CLI. 2016-12-28 17:00:33 +05:30
Ratnadeep Debnath
92b6678d1b Initial implementation of BuildConfig support for Openshift provider. 2016-12-28 17:00:32 +05:30
Shubham Minglani
6a151c6267 add stdin_open, tty support, add tests, fix #344
This adds supports for stdin_open: bool and
tty: bool support for kubernetes and openshift
providers in kompose. This maps to the
template.Spec.Containers[0].Stdin and
template.Spec.Containers[0].TTY in Kubernets
world.

Also, added tests.

Fixes #344
2016-12-28 15:58:45 +05:30
Shubham Minglani
7e378cd546 implement expose service, add tests, fix #140
Implements a kompose specific docker compose label "kompose.service.expose" which can be used to expose the specified services externally. The accepted values are of type string.
If the value is set to "true", the provider sets the endpoint automatically, and for any other value, the value is set as the hostname. If multiple ports are defined in a service, the first one is chosen to be the exposed.

Unit tests, functional tests, glide updates and docs have also been added in this commit for the related feature.
2016-12-21 20:00:38 +05:30
Tomas Kral
3419ae7fe1 few updates based on review 2016-12-20 16:58:28 +05:30
Tomas Kral
f20e6f3fa9 checkUnsupportedKeys for transformers 2016-12-20 12:21:52 +05:30
Tomas Kral
e4f9b59b4d Separate unsupported key check for every loader 2016-12-20 12:21:03 +05:30
Suraj Deshmukh
bb9e4fba61 Generic service type handler for kompose
Moved label handling code from Transformer to loader,
to make it generic to handle creating service types.

Added new attribute to ServiceConfig which gets populated
in loader.

Fixes #273
2016-11-16 22:01:01 +05:30
sebgoa
00331589a3 Fix license headers, This closes #223 2016-11-01 15:01:27 +01:00
Dusty Mabe
9ce3f0cf15
cli: add --emptyvols option 2016-10-28 16:05:59 -04:00
Tuna
7435f822ed Merge pull request #230 from ngtuna/unsupportedkey
update unsupported key list
2016-10-25 15:29:31 +02:00
Tuna
c29ef944ce correct networks key 2016-10-24 21:47:16 +02:00
Tuna
99055b4d1b update unsupported key list 2016-10-21 22:55:14 +02:00
Suraj Deshmukh
fd09efed43 support for volumes_from docker-compose construct
Now a user can provide volumes_from to share volumes
from other service so here the PVC created for that
service will be shared by service calling volumes_from
2016-10-19 09:15:47 +05:30
Suraj Deshmukh
b969f7aa44 --provider global flag for kompose
Now a user can select a provider using global flag
--provider=openshift to select openshift provider
or --provider-kubernetes to select kubernetes provider
if nothing is provided kubernetes is the default provider.

Fixes #179
2016-10-06 09:37:54 +05:30
Tomas Kral
cc4f162cea
Remove Entrypoint from Kompose object
We had Command and Args together with Entrypoint in Kompose object.
This doesn't make much sense, as Entrypoint and Command are same thing.
I've removed Entrypoint from Kompose object in favor of Command to keep
same naming convensions as in Kubernetes.

Entrypoint from docker-compose.yml is now saved to Command and Command
is saved to Args (http://kubernetes.io/docs/user-guide/containers/).

docker-compose.yml | Kompose object
-------------------|---------------
  Entrypoint       |    Command
   Command         |     Args
2016-09-02 10:10:34 +02:00
Tomas Kral
8590a98504
docker-compose - fix Command and add Entrypoint support 2016-09-02 10:10:34 +02:00
Janet Kuo
14726f1a53 Add unit test for komposeConvert 2016-08-12 18:21:56 -07:00
Tuna
469b50c33d rebase master 2016-08-12 10:38:33 +07:00
Tuna
baedd92036 move k8s base functions into k8s package 2016-08-12 00:46:03 +07:00
Tuna
d532b29d95 clean code 2016-08-11 23:31:20 +07:00
Tuna
e867d35e39 creat kobject package, make loader and transformer refering to it 2016-08-11 23:31:20 +07:00
Tuna
85b0b6a2b8 breaking app.go into loader and transformer, to be continue 2016-08-11 23:28:49 +07:00