Commit Graph

177 Commits

Author SHA1 Message Date
Hang Yan
bc28ffc675
Upgrade deployment/daemonset to apps/v1 (#1207) 2019-12-26 16:36:11 +08:00
Hang Yan
73ec0abab2
Remove duplicate of configmap (#1206)
* also change the name of the generated cm
2019-12-26 08:53:41 +08:00
Hang Yan
d52fd0d877
Modify default kubernetes client's apiserver url (#1204)
* Modify default kubernetes client's apiserver url
2019-12-24 00:47:10 -10:00
Chander G
356c64890c fix tests related to secrets (#1198)
1. fix the path used to read secret data
without this fix, the path to the compose file is added to the already
absolute path, hence readFile was unable to find the secrets file

2. fix the expected json format
mountPath includes the entire path including the name of the secret
2019-12-04 10:32:29 +08:00
João Vitor Paes de Barros do Carmo
30736a3973 Add support for file based secret (#1159)
* Support file based secret
* Fix issue about read-only volume path and add support to absolute path at long-syntax
2019-12-01 12:05:31 +08:00
Mudit Verma
ac2b852955 Network Key Translation Feature and test cases (#1195) 2019-12-01 10:19:23 +08:00
Kubernetes Prow Robot
ab111b5d88
Merge pull request #1147 from hangyan/push-image-flag
Add flag to turn off push image when kompose up
2019-10-31 06:31:37 -07:00
Charlie Drage
d0526d1d75 Fix tests (#1175)
For some reason, tests have been coming back as always positive (despite
some tests which are failing...)

This PR addresses it
2019-10-25 17:33:11 +08:00
Alan Justino da Silva
30655b4dd6 Copy the service labels also to Deployment Pod spec annotations (#1166)
* Copy the service labels also to Deployment Pod spec annotations

This allows kube2iam to work

* Remove test file forgotten from version 1.0.0

* Update test fixtures to have Deployment.spec.t.m.annotations

* Fix name conversion "test_server" -> "test-server"

It looks unrelated to my changes, but still changing.

* Fixing some more output fixtures
2019-09-02 10:06:28 +08:00
Hang Yan
302e918093 Add flag to turn off push image when kompose up 2019-06-25 13:38:00 +08:00
Kamil Kieliszczyk
66ac4aff4f Add kompose.image-pull-secret and kompose.image-pull-policy (#1091)
* Add kompose.image-pull-secret

* Add kompose.image-pull-secret tests

* Add kompose.image-pull-policy

* Add kompose.image-pull-policy tests

* ignore .coverprofile

* Fix typo
2019-02-07 09:50:53 -05:00
huikaihoo
40c1b8cf87 Support multiple hostnames on expose label in service for Kubernetes (#1092)
* Support multiple hostnames on label (kompose.service.expose) separated by semicolon (;)

* Multiple hostnames on expose label separated by comma; Ignore leading / trailing spaces and repeated commas; Updated test cases and documents.
2019-01-31 09:34:04 -05:00
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
c0360e066b
Merge pull request #1020 from hangyan/fix/env-file-env
Fix environment with env_file bug
2018-07-10 13:58:59 +08:00
Hang Yan
3b04a9178a Fix environment with env_file bug 2018-07-10 13:15:36 +08:00
Li Yi
6eb1aed7ab Fix invalid port name with uppercase characters (#1029)
* Fix invalid port name with uppercase characters

Signed-off-by: Li Yi <denverdino@gmail.com>
2018-06-05 14:18:40 +08:00
skyc024
8b43b8e6b7 Fix golint warning 2018-05-17 06:01:48 +00:00
xianlubird
a4efdd6cca Add label 'kompose.controller.type' set service convert controller type 2018-05-12 11:52:23 +08:00
xianlubird
84b419c7ef Support compose global deploy mode to daemonset 2018-05-07 15:19:47 +08:00
Hang Yan
852078cc5c Remove incorrect logging about headless service (#991) 2018-04-26 15:11:24 -04:00
Hang Yan
f3412a7399 Add headless service type label
Also remove the relation between restart and service create
2018-04-15 00:23:48 +08:00
Haoyun
077ef90e01
typo fix
typo fix
2018-04-03 17:12:30 +08:00
Hang Yan
505cb8b754 Fix golint warnings 2018-03-25 16:22:08 +08:00
Charlie Drage
5d733f33cf
Merge pull request #954 from hangyan/support-compose-v3.2
Add support for compose v3.2
2018-03-22 10:02:32 -04:00
Hang Yan
cf833c8818 Support hostpath volume 2018-03-16 10:40:25 +08:00
Hang Yan
61ff9eeeaa Add support for compose v3.2 2018-03-09 00:13:10 +08:00
Suraj Narwade
908e3f1b59
Merge pull request #907 from caglar10ur/serviceports
Allow services to use same port with different protocols
2018-03-07 12:29:05 +05:30
Hang Yan
e119b30ebd Fix image build path error 2018-02-24 15:40:00 +08:00
S.Çağlar Onur
e6ae470830 Allow services to use same port with different protocols
kompose fails if compose file declares different protocols for the same port. eg;

...
     ports:
      - 666:666/udp
      - 666:666/tcp
...

This PR adds the port to the output and also makes sure that names are unique for each port/protocol pair.
This is supported with LoadBalancer (kubernetes/kubernetes#2995) so trying to use this config with LB panics.
2018-01-17 11:26:03 -08:00
Piyush Garg
52f8f1f2b4 Added Case for Config Map in kompose down.
To implement this, added label in
configmap object at the time of init

Fixed ConfigMap test because we are
adding one more field labels in metadata
2017-12-22 15:44:10 +05:30
Oliver Bristow
35a782024d Add kompose.service.expose.tls-secret 2017-12-18 15:56:38 +00:00
Charlie Drage
84be7400a2
Merge pull request #846 from surajnarwade/buildv3
Added support for build key in v3
2017-11-30 09:06:32 -05:00
Suraj Narwade
126d9820c4 Adding --controller flag in up & down
To make `kompose up` & `kompose convert` equal in feature, This PR will
add `--controller` flag for `kompose up` as well as `kompose down`
so that user experience will be the same for `up` & `convert`
Resolves #798

since we are adding `--controller` to `up` and `down`, So respective code to deploy and undeploy also being added for `daemonset` and `replicationcontroller`

Added tests for `--controller`
2017-11-27 15:26:24 +05:30
Suraj Narwade
5de4aa85f8 Added sirupsen and updated all occurances
Updated `sirupsen`, `docker/cli`, `docker/libcompose` in `glide`,
Also changed `Sirupsen` with `sirupsen` in all kompose packages as well as in
`docker/distribution` packages
2017-11-27 12:28:46 +05:30
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
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
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
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
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
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
cf6db81202 Merge pull request #710 from surajnarwade/sanity_check_fix
Updated code with go lint result
2017-07-14 14:46:27 -04:00
Suraj Narwade
91a6e79d6f Updated code with go lint result
Updated code with suggestion given by `go lint`
2017-07-14 11:11:17 +05:30
fate-grand-order
69f4b46813 fix some typos to make goreport happy 2017-07-13 18:21:37 +08:00
Charlie Drage
787b7d9261 kubernetes-incubator -> kubernetes
Today, we graduate from the incubator, thus all links are updates from
kubernetes-incubator to kubernetes
2017-07-12 15:42:13 -04:00
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
Abhishek
719dae97e4 Environment variabled are populated in random order, causing functional tests in golang #518 to fail 2017-06-14 12:58:56 +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
Abhishek
529e6c674f sort output when creating kubernetes/openshift objects 2017-05-09 23:56:54 +05:30
gitlawr
3916eb9f60 Fixes #575
This commit Add support for cap_add & cap_drop which maps to
Pod.Spec.Container.SecurityContext.Capabilities.Add/Drop
Added unit tests for ConfigCapabilities function
Updated conversion.md on support for these keys
2017-04-28 14:41:12 +08:00
Suraj Narwade
9a6c1d99b3 Added warning after PVC creation
Partially resolve #376 and #345
Added warning, such that PV should be created before PVC or
if dynamic provision is there, no need to create PV.
2017-04-13 14:25:14 +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
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
Charlie Drage
27fc70aa52 Merge pull request #536 from kadel/pr477-angain-and-better
new take on "Kompose will keep trying its job #477"
2017-04-10 12:29:41 -04:00
Tomas Kral
d21c240e3e
skip to next object when there is an error with deletion 2017-04-03 18:19:33 +02:00
Suraj Narwade
da6a2e946a
Kompose will keep trying its job
fixes #270

all errors in undeploy method(both kubernetes and openshift) are appended in a slice of errors,
and then it will be returned after successful deletion of all components.
2017-04-03 18:19:06 +02:00
Charlie Drage
8e0de50d38 Revert "Kompose will keep trying its job" 2017-04-03 11:52:01 -04:00
Abhishek
6e0b934f77 Propagate underscores into valid names
Now we can provide service name with "_" in docker-compose files and they will by converted as "-" in the generated artifacts by kompose eg, if the service name in docker-compose file is "foo_bar" then it will be converted into "foo-bar" in the generated artifacts
2017-04-03 13:06:33 +05:30
Suraj Narwade
80b15c1d95 Kompose will keep trying its job
fixes #270

all errors in undeploy method(both kubernetes and openshift) are appended in a slice of errors,
and then it will be returned after successful deletion of all components.
2017-03-31 14:14:14 +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
Abhishek
55ad1d9b1f delete objects based on label
This PR uses the "SelectorFromSet()" function which takes alabel or
selector as an argument returns all the object that uses that label or
selector. Once we get the object that uses a particular label we can
further do the delete operation on them. This is similar to "kubectl
delete <object> --selector=<key>=<value>". Also the label has been
modified from service to io.kompose.service.
2017-03-24 00:31:33 +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
Shubham Minglani
5cb598fa5b return errors instead of logrus.Fatal calls
This commit refactors the code to remove more or less
all occurences of logrus.Fatalf() from the code under
pkg/ except for app.go where all the errors are being
handled currently.

This is being done since random logrus.Fatalf() calls
all around the code was making handling the errors,
unit testing and troubleshooting a bit more painful.

logrus.Fatalf() calls are either replaced by
return errors.New("new error")
or
return errors.Wrap(err, "annonate error")
calls, and the function signatures are accordingly
changed to accomodate the new return values.

The unit tests which previously used to check
if logrus.Fatalf() calls worked fine have also
been fixed to only check for errors now.

Fixes #416
2017-03-15 13:30:21 +05:30
Charlie Drage
c0043ebd11 Clean up logrus
Replaces "log" from "logrus" as commonly used in large Go projects.

Makes it easier from a developer perspective to use `log.Info`,
`log.Debug`, etc.
2017-02-27 10:53:24 -05:00
Abhishek
082e2351a0 abstract_out_api.PodSpec 2017-02-22 20:25:55 +05:30
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
Charlie Drage
cb6c9e9755 Removes the TCP output on the Kubernetes / OpenShift artifacts
If TCP is passed in as the protocol, by default, we add TCP as the
protocol within the Kubernetes or OpenShift artifacts.

By default, TCP is already selected within Kubernetes and thus having
the TCP output is redundant.

This commit checks to see if TCP has already been selected, and if it
has, ignores adding it to the list of ports.

Closes https://github.com/kubernetes-incubator/kompose/issues/392
2017-02-01 13:33:49 -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
3f10691838 Merge pull request #387 from cdrage/warn-if-passed-z-to-volume
Ignores :z or :Z when passed in as a volume string
2017-01-25 13:56:40 +01:00
sebgoa
3193ac3bd7
Handle Headless Services when no ports are present 2017-01-25 11:28:29 +01:00
Charlie Drage
b8006d0620 Ignores :z or :Z when passed in as a volume string
We're going to ignore :z / :Z for labeling aka SELinux when being passed
in via Docker Compose.

Closes https://github.com/kubernetes-incubator/kompose/issues/176
2017-01-20 15:20:41 -05:00
Tuna
fa8157a555 add deploy/undeploy pod only
ref: #342
2017-01-10 16:53:21 +01:00
Tomas Kral
4f176b847e
fix golint errors 2017-01-05 10:31:11 +01:00
Ratnadeep Debnath
92b6678d1b Initial implementation of BuildConfig support for Openshift provider. 2016-12-28 17:00:32 +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
Chris Baumbauer
072d4815ee #231 Invoking kompose --bundle X.dab convert --stdout will produce two differently ordered results (#338) 2016-12-18 09:01:42 -05:00
Suraj Deshmukh
78845d3954 Merge pull request #334 from surajssd/create_pod
support for raw pod output without controller
2016-12-15 11:57:13 +05:30
Abhishek
6ad54a36e2 added support for OpenShift down 2016-12-15 11:06:00 +05:30
Suraj Deshmukh
6ea5f72e40 support for raw pod output
if a user specifies a docker-compose service
with restart value as "no" or "on-failure"
then normal pod will be created as against
to a controller and a pod.
2016-12-13 19:24:25 +05:30
Tomas Kral
4e42a07be2
gofmt 2016-11-22 13:02:31 +01:00
Tuna
62c34a2208 correct display when using --emptyvols 2016-11-05 21:57:33 +01:00
Janet Kuo
c9ed84f597 Merge pull request #249 from dustymabe/dusty-fix-readonly
CreatePVC: correct setting of read/only access
2016-11-03 13:48:56 -07:00
sebgoa
00331589a3 Fix license headers, This closes #223 2016-11-01 15:01:27 +01:00
Dusty Mabe
6523da8120
CreatePVC: correct setting of read/only access
Fixes #237

Also update the code to use the constant values for api.ReadWriteOnce
and api.ReadOnlyMany.
2016-11-01 09:17:40 -04:00
Tomas Kral
d9c5de661a Merge pull request #248 from dustymabe/dusty-empty-vols
Adding support for choosing empty volumes
2016-10-30 17:49:50 +02:00
Janet Kuo
20a13d3eef Merge pull request #254 from dustymabe/dusty-deployment-deploymentconfig
Match case with API objects when printing to terminal
2016-10-28 17:38:04 -07:00
Dusty Mabe
9ce3f0cf15
cli: add --emptyvols option 2016-10-28 16:05:59 -04:00
Dusty Mabe
df09fd5193
ConfigVolumes: enable creating EmptyDir volumes again
Will enable the user to specify which type of volume they want
in a subsequent commit.
2016-10-28 16:05:59 -04:00
Dusty Mabe
30752b7b93
ConfigVolumes: rename pvc var to PVCs
It is a list of persistent volume claims.
2016-10-28 16:05:59 -04:00
Dusty Mabe
f290cd6541
ConfigVolumes: rename volumesMount to volumeMounts 2016-10-28 16:05:59 -04:00
Dusty Mabe
48aa4c7f7a
transformers: match API object capitalization in text output 2016-10-28 15:22:40 -04:00
Dusty Mabe
51dea8283a
transformers: add Opt variable as object data
This is so you can set Opts on instance creation of
kubernetes.Kubernetes and openshift.Openshift. This is useful
so that we can pass option information arround without having
to do it on the call stack every time.
2016-10-27 11:48:35 -04:00