Commit Graph

55 Commits

Author SHA1 Message Date
Charlie Drage
50ec43d1e0
tests: fix flakey tests (#1886)
#### 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 two flakey tests. One which is returning them in random
orders..

The other which is not available to run on mac due to not being able
"access" the folders.

#### Which issue(s) this PR fixes:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

N/A

#### Special notes for your reviewer:

N/A

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
2024-05-30 11:51:02 -04:00
jose luis
3c189aaff1
Merge branch 'main' into feature-1846-network_mode-service
Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
2024-04-25 17:31:49 +02:00
jose luis
8ee944c2be
Merge branch 'main' into feature-1846-network_mode-service 2024-04-22 15:46:45 +02:00
jose luis
bbd91be049
Merge branch 'main' into feature-1794-auto-configmaps
Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
2024-04-22 13:37:00 +02:00
jose luis
d43e210f04
Merge branch 'main' into feature-1846-network_mode-service
Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
2024-04-10 18:21:25 +02:00
jose luis
e4ccf2edc9
rectified markdown spacing on columns
reformat k8sutils_tests.go

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
2024-04-10 13:39:28 +02:00
jose luis
405ab61479
Merge branch 'main' into feature-1631-add-hpa 2024-04-10 13:24:35 +02:00
jose luis
1010e1a916
Merge branch 'main' into feature-1794-auto-configmaps 2024-04-10 00:50:37 +02:00
jose luis
e9f64cfd81
added more e2e, more tests
fallback to skip volume mount and log warning when path cannot be resolved, as /sys, /root, /var/lib/docker

in e2e TestMultipleContainersInPod directory /data replaced with /data-dir

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
2024-04-10 00:33:57 +02:00
Jose Luis
c9c1080306
adds a label for initContainers, test and user-guide (#1840)
* adds a label for initContainers, test and user-guide

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

* solved suggestion version from 2 to 3, coments

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

* test e2e

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

* add target to kompose build

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

* chore(deps)(deps): bump golang.org/x/tools from 0.16.1 to 0.19.0 (#1836)

Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.16.1 to 0.19.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.16.1...v0.19.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* changed var names contaers to containers
changed labels to kompose.init.container.name, kompose.init.container.image, kompose.init.container.command
fixed documentation, tests and e2e
also merged main with new commits to this branch

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

---------

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kubernetes Prow Robot <20407524+k8s-ci-robot@users.noreply.github.com>
2024-04-08 08:49:09 -04:00
jose luis
4cd0b268fc
add configmaps derived from file and dir
add tests and e2e
function isconfigfile check if we need to use configmap and mount in readonly
readonly not asigned because not fail e2e

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
2024-04-07 21:18:01 +02:00
jose luis
8ff0f334eb
fix EOF, DefaultMaxReplicas set to 3, extended user guide about hpa, more tests
add warning in situations like:
- maxreplicas < minreplicas
- value from label < 0
- validate percentage in cpu, memory metrics
2024-04-04 20:21:00 +02:00
jose luis
04acbf111f
added tests
add e2e
2024-04-03 19:31:46 +02:00
jose luis
516930ccee
added more tests
e2e tests
fixed name labels
2024-04-02 17:31:19 +02:00
jose luis
58974092a5
add networkmode service:
added tests
fixNetworkModeToService is responsible for adjusting the network mode of services in docker compose (services:) and generate a mapping of deployments based on the network mode of each service merging containers into the destination deployment, and removing transferred deployments

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
2024-03-30 21:17:47 +01:00
jose luis
a38f7f9ea3
added this labels:
kompose.hpa.minreplicas
kompose.hpa.maxreplicas
kompose.hpa.cpu
kompose.hpa.memory

documentated labels user_guide.md

generate custom metrics from cpu, memory and set min/max replicas

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
2024-03-26 20:58:57 +01:00
jose luis
578fa72a9a
fix issue 1793
* fix issue 1793  https://github.com/kubernetes/kompose/issues/1793
*add tests

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

formated k8utils_test.go

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

labels formatted as name"-"envName to match fixtures when performing the gitHub action

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

removed this piece code because apply it later, and it is redundant

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

Refactor test in k8sutils_test.go to extract the last 63 characters. This addresses the impact of the removed code that previously truncated the input with if len(envName) > 63 { envName = envName[len(envName)-63:] }

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

changed to name function to getUsableNameEnvFile

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

fix issue 1793

* fix issue 1793  https://github.com/kubernetes/kompose/issues/1793
*add tests

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

labels formatted as name"-"envName to match fixtures when performing the gitHub action

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>

changed to name function to getUsableNameEnvFile

Signed-off-by: jose luis <2064537+sosan@users.noreply.github.com>
2024-01-24 23:41:01 +01:00
Martin Jirku
f80ad97307
feat(1765): update tests, move unit test to proper file, improve removeEmptyInterfaces algo
Signed-off-by: Martin Jirku <martin@jirku.sk>
2024-01-01 12:07:44 +01:00
AhmedGrati
771e564645 test: add unit-tests for FormatEnvName function
Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
2023-11-05 13:20:25 +01:00
AhmedGrati
3172bc05b5 fix: remove e2e flakiness by making the loop deterministic
Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
2023-10-24 16:19:22 +01:00
AhmedGrati
c9f3ff0190 test: add unit-test for read only fs support
Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
2023-07-14 16:18:29 +01:00
Lctrs
2ad5745d58
feat: migrate from libcompose to compose-go (#1547)
* feat: migrate from libcompose to compose-go

libcompose has been deprecated since summer 2021 in favor of https://github.com/compose-spec/compose-go.
Kompose should now be able to load all versions of compose.

* chore: replace golint with staticcheck

golint has been deprecated. Recommended replacement is staticcheck.
2023-01-12 15:17:22 -05:00
AhmedGrati
acb8046f84
Fix environment variables interpolation (#1524) 2022-11-19 10:35:33 +08:00
AhmedGrati
fd7b751564
Fix container name (#1528)
* fix: update get container name function
* test: add a test for the introduced fix
2022-11-13 21:33:47 +08:00
ichx
d55071e9d6
Support tcp/http liveness/readiness probe (#1449) 2021-11-03 23:30:38 +08:00
Hang Yan
5d7ed192a4
Code Refactor (#1438)
* Code refactor
Signed-off-by: Hang Yan <hang.yan@hotmail.com>
2021-10-03 17:33:43 +08:00
ichx
2f081075a8
Fix misuse in struct kobject.ServiceConfig.Port (#1423) 2021-08-29 21:37:22 +08:00
tk42
f7f987de49 Add ServiceAccountName
The label `kompose.service.accountname` defines the service account name
to provide the credential info of the pod.
2021-07-24 08:44:07 +09:00
Rémy Léone
395d99fb7d
add support for golangci-lint (#1373) 2021-04-07 11:10:56 +08:00
Rémy Léone
d1e538e2d4
fix goimports (#1372) 2021-04-03 11:50:28 +08:00
João Vitor Paes de Barros do Carmo
0036f0c32b
Add readiness healthcheck generation by label (#1366) 2021-03-17 18:02:50 +08:00
Hang Yan
525b68f027
Go mod (#1305)
* Use go mod instead of glide
* Add `--with-kompose-annotation` flag to allow us to switch it off for tests
* Remove hostpid support (since the newest sdk does not support it)
* Create new test script and fixtures
* Remove replicationcontroller support
2020-08-07 17:25:52 +08: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
Hang Yan
3fe1b5313c Fix typo in function name 2018-02-07 11:22:29 +08:00
Li Yi
fa5281d440 Fix the cpu limits and requests in generated deployment file
Signed-off-by: Li Yi <denverdino@gmail.com>
2017-10-09 19:22:31 +08: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
796313f626 Merge pull request #704 from cdrage/graduate-from-incubator
kubernetes-incubator -> kubernetes
2017-07-12 16:49:55 -04: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
Suraj Narwade
8dfa0e0689 Refactoring code as per gosimple check
This PR refactors some code bits as per `gosimple` tool check.
2017-07-12 15:48:07 +05:30
Charlie Drage
ce32bb817d 2016 -> 2017 for licensing
New year, update to the license.
2017-06-28 10:49:52 -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
Abhishek
529e6c674f sort output when creating kubernetes/openshift objects 2017-05-09 23:56:54 +05:30
Suraj Narwade
af43de2c2e Moved cpu_shares and cpuset to unsupported keys
Resolves #272 and #267

As there is no direct mapping of `cpushares` and `cpuset` to kubernetes,
it should not be read and should be moved to unsupported keys.
2017-04-05 22:46:57 +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
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
Shubham Minglani
b73efa54f2 set strategy to Recreate if vols, add tests,docs
When volumes are specified in the Docker Compose
files, then in case of Kubernetes, Deployment's
Spec.Strategy.Type and in case of OpenShift,
DeploymentConfig's Spec.Strategy.Type are set to
"Recreate". This is a safer deployment strategy
when Volumes are getting used.

This commit also adds unit tests for Kubernetes
as well as OpenShift, and fixes the failing
functional tests (tests.sh) due to the change.

No functional tests have been added since
the functionality is already covered when the
volume mounts are being tested earlier in the
file.

This fixes #264
2017-02-20 11:44:43 +05:30
Tomas Kral
8f2dd5b03b
Test Headless Services 2017-01-25 11:28:29 +01:00
Suraj Deshmukh
d64a441e53 Fixed warnings related to user type in tests
Fixes # 343

Type of user is not string and that's what was being provided
in tests so fixed it and now tests output is cleaner.
2017-01-16 12:07:33 +05:30