Commit Graph

96 Commits

Author SHA1 Message Date
Suraj Narwade
ada8af2410 Added functional test 2017-11-30 11:14:44 +05:30
Charlie Drage
28601fa6ea Update vendoring 2017-10-10 12:55:57 -04: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
Li Yi
d283bbbcc2 Fix the cpu limits and requests in generated deployment file
Signed-off-by: Li Yi <denverdino@gmail.com>
2017-10-10 10:04:34 +08: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
35166b8871 Merge pull request #816 from surajnarwade/tmpfsfix
Fixed tmpfs with mode failure
2017-09-26 15:24:35 -04:00
Suraj Narwade
269f604094 Fixed --volumes validation
Now, `--volumes` argument will validate it's input, it will only allow
`persistentVolumeClaim` or `emptyDir`, otherwise it will throw an error.
2017-09-25 17:25:57 +05:30
Suraj Narwade
8a19c47b1a Fixed tmpfs with mode failure
Fixes #807
now kompose will ignore mode of tmpfs and will pass only mount path.
2017-09-25 14:44:03 +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
Shubham
4f6b92f6c8 Merge pull request #759 from cdrage/add-healthcheck
Adds healthcheck
2017-08-27 09:09:54 +05:30
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
Suraj Narwade
8b952abe29 Added functional test for docker compose files in Example directory
Fixes #793
2017-08-24 17:09:51 +05:30
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
ec5c4d8550 Adding save command to annotation
This command will add `kompose command` used to generate artifacts as well as `kompose version`,
for ex,

```
metadata:
    annotations:
      kompose.cmd: kompose convert -f /home/snarwade --stdout
      kompose.version: 1.0.0 (HEAD)
```

For functional test, Now each test has template like,

```
 "annotations": {
           "kompose.cmd": "%CMD%",
           "kompose.version": "%VERSION%"
```

Because, for every machine these values will be different.

Updated functional test with new annotations
2017-08-14 12:22:33 +05:30
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
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
9dcb2bfba6 added support for restart-policy keys in v3
Resolves `restart_policy` from issue #644
2017-07-06 17:44:19 +05:30
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
cf39f78435 Merge pull request #653 from cdrage/remove-dab
Disable dab
2017-06-21 07:39:59 -04:00
Tomas Kral
ef8c7a7a0a
fix env substitution for docker compose v3 2017-06-20 15:16:12 +02:00
Charlie Drage
b8a46895a6 Disable DAB
See issue: https://github.com/kubernetes-incubator/kompose/issues/390

Disable DAB as it is hard to maintain / not much usage / DAB is still
experimental in Docker and there hasn't been much movement:
https://github.com/moby/moby/issues/26876

MarkDeprecated does not work at the moment due to issue:
https://github.com/kubernetes-incubator/kompose/issues/652

However, that is not a blocker as we `fatalF` within `ValidateFlags`
2017-06-20 09:02:53 -04:00
Charlie Drage
ee7961216f Merge pull request #603 from procrypt/error_with_volume_name
PVC name changes if volumes containes .(dot) in it
2017-06-19 09:39:59 -04:00
Abhishek
c8881f5aa4 update created artifacts for k8s and openshift
update created artifacts for kubernetes and openshift so that env variables are populated in a particular order
2017-06-16 12:35:27 +05:30
Suraj Deshmukh
f823a22e64 Merge pull request #590 from surajnarwade/label-fix
Failing when port is specified with labels
2017-06-15 14:56:30 +05:30
Suraj Narwade
209cda28d2 Failing when port is specified with labels
Resolves #522
Kompose will give FATAL error if labels are given but ports are not defined
2017-06-15 09:30:01 +05:30
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
Abhishek
c40bb4bb3a change volume name with generated deployment file
if volumes in docker file is defined as
      volumes:
        - .:/code
    Then the PVC created by kompose will containes .(dot) in it.
       .-persistentvolumeclaim.yaml
2017-06-14 14:31:07 +05:30
Tomas Kral
89cf88f665 Merge pull request #638 from surajnarwade/show-diff
Failing test will show diff
2017-06-14 09:28:30 +02:00
Charlie Drage
2b58307191 Add v3 support
This does a major refactor on the compose.go functions as well as brings
in a new era of v3 support to Kompose.

Similar to how we utilize libcompose, we utilize docker/cli's "stack
deploy" code which has a built-in v3 parser. We convert the parsed
structure to our own and then convert it to Kubernetes/OpenShift
artifacts.
2017-06-13 09:44:48 -04:00
Suraj Narwade
883d11c049 Failing test will show diff
If test in `make test-cmd` is failing, now it will show diff so that
it will be easy to debug.

for example,

```
===> Starting test <===
convert::expect_success_and_warning: Running: 'kompose -f /home/snarwade/go/src/github.com/kubernetes-incubator/kompose/script/test/fixtures/service-name-change/docker-compose.yml convert --stdout -j' expected_output: '/home/snarwade/go/src/github.com/kubernetes-incubator/kompose/script/test/fixtures/service-name-change/output-k8s.json' expected_warning: 'Unsupported root level volumes key - ignoring'
WARN Unsupported root level volumes key - ignoring
WARN Unsupported depends_on key - ignoring
103c103
<                     "value": "bitnami_wordpres"
---
>                     "value": "bitnami_wordpress"
FAIL: converted output does not match
```
2017-06-13 14:20:52 +05:30
Suraj Narwade
581e181967 Validate dockerfilepath in buildconfig
This PR will resolve #594 by validating dockerfilepath based on whether
it is relative path or not.
2017-05-30 16:31:20 +05:30
Suraj Deshmukh
1c64b016dc Merge pull request #592 from cdrage/change-git-command
Use old git command
2017-05-18 09:12:09 +05:30
Tomas Kral
792976da1f
some of created objects were missing io.kompose.service label
label added to BuildConfig, DaemonSet, ReplicationController, Deployment and Pod
2017-05-16 17:56:32 +02: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
Charlie Drage
f0c4addbaf Use old git command
Some versions of git don't have git-url (case in point on Debian 8, no
get-url on packaged git).

Use old command in getting URL.
2017-05-09 08:55:55 -04:00
Suraj Narwade
aacde86eb9 Fixes fixture test for build context
Resolves #576

This PR includes `output-os-template.json` in `nginx-node-redis` example,
which is basically output template contains `%URI%` and `%REF%` variables
which will be filled while initializing test cases and new will be stored as
`/tmp/output-os.json`
This will remove the problem of git uri and ref.
2017-05-08 17:54:24 +05:30
Suraj Narwade
1eb162d697 Updated Vendoring 2017-04-27 21:38:38 +05:30
Suraj Narwade
605d643a84 Adding code for consistent build context
fixes #445

This PR was partially fixed by docker/libcompose#450, which now gives consistent build context,
also it modifies the function getAbsBuildContext to create accurate build context, Unit test are being modified
according to new structure.
2017-04-27 21:38:38 +05:30
Tuna
65c9cf9bd8 Merge pull request #557 from procrypt/driver_local
fix driver:local in prefixing volumes with current dir name
2017-04-27 15:25:50 +07:00
Abhishek
7eccb37c19 fix driver:local in prefixing volumes
If we have a docker-file with root level volumes and we do a kompose up
using that docker-file, libcompose will add an additional _ followed by
the current directory name. Since kubernetes doesn't allow _ in the
objects created so kompose up will fail to deploy it. As a solution we
replace _ to - and we can then deploy it successfully.
2017-04-26 20:14:22 +05:30
Abhishek
ec85012a8c typo in nginx name 2017-04-25 11:14:35 +05:30
Charlie Drage
0464d24b40 Merge pull request #511 from kadel/fix-ingress-down
add missing 'io.kompose.service' label to Route and Ingress
2017-04-12 11:47:17 -04:00
Charlie Drage
ee44a2630f Move docker-compose.yml test file to tests
Moves a file that was incorrectly being used from examples to
script/test/fixtures.
2017-04-04 09:09:12 -04:00
Suraj Narwade
df014bebd6 Fixed functional tests
Fixes #431

fixed commands where output showing `command not found` and k8s output
added for restart-options example.
2017-03-30 15:06:57 +05:30
Tomas Kral
f8da61436e
add missing 'io.kompose.service' label to Route and Ingress
This was caussing 'kompose down' not to delete Route and Ingress
2017-03-24 14:42:53 +01:00