question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature]: Enable Helm Charts usage

See original GitHub issue

Module

New Module

Problem

I want to use TestContainers in a CI environment, that run on K8s. I’m using Jenkins, and I have no Docker runtime abilities - hence Testcontainers is unusable.

Solution

I’d like to have a module in testcontainers that will be similar to the testcontainers-docker-compose module, but for Helm Charts. This will make Testcontainers unusable to me, to an awesome library that will help me perform tests. Basic Helm charts support will let me create anything I will need - MongoDb, Kafka, anything, during my tests!

In my opinion, this feature can level up Testcontainers for many people.

Benefit

This will open the door for making Testcontainers an ultimate DevOps library, instead of a specific technology vendor-locked (for Docker) library.

Alternatives

Resolve this super important issue. https://github.com/testcontainers/testcontainers-java/issues/1135

Would you like to help contributing this feature?

Yes

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
DRoppeltcommented, Jul 27, 2022

I want to use TestContainers in a CI environment, that run on K8s. I’m using Jenkins, and I have no Docker runtime abilities

I would like to point out that this not not quite as black&white. You can get docker to run in k8s by using a dind-rootless (dind=docker-in-docker) image as the container hosting the necessary daemon for testcontainers`.

see https://github.com/testcontainers/testcontainers-java/issues/1135#issuecomment-901833509 & https://github.com/testcontainers/testcontainers-java/issues/1135#issuecomment-904526644

If you are using the kubernetes plugin in Jenkins, you can setup following podspec:

  • 2 containers, one is named jnlp (optional, as jenkins brings its own jnlp container if nothing is set). The other “dind-rootless”
    • the client, the one using the daemon to i.e. start docker containers, is the jnlp container
    • in my env we have custom jnlp containers anyways, so YMMV
  • shared emptyDir on /certs, which allows the client to access the certs of the daemon. The daemon creates them on startup
  • client: env DOCKER_HOST=tcp://localhost:2376 to change the port due to tls
  • client: env DOCKER_TLS_VERIFY=1
  • client: DOCKER_CERT_PATH=/certs/client so that it knows where to fetch the certs
  • set a flag for elevated priviledges (not sure if it is on pod or container level)

Thats how I got it to run in my Jenkins environment. The started pod has 2 containers, the jnlp is where the CI happens (e.g. it is a jdk17 with some added tools) the second container hosts the docker daemon required for testcontainers. The 2 containers talk with each other via localhost. I can do docker build ..., docker run ... and use testcontainers via maven just like a regular local build. The setup might be condensed down to a simpler config, but a rootless container was necessary in my env. It has some restrictions (https://docs.docker.com/engine/security/rootless/), which, tbh, I do not understand but seem to be irrelevant for CI.

1reaction
kiviewcommented, Jul 26, 2022

Thanks for raising the feature request @lynch19. However, Testcontainers by design requires a container runtime with a Docker compatible API and is based on multiple assumptions for the container runtime to share specific characteristics with Docker. We don’t see how your feature request fits into the current vision of Testcontainers.

I’m using Jenkins, and I have no Docker runtime abilities - hence Testcontainers is unusable.

Please note that Testcontainers does not require a Docker-compatible runtime to be present on the same host that executes the test. Testcontaners supports configuring a remote host and many users in the community have such setups in specific CI environments.

As a side note, you can use this Testcontainers module to test helm charts itself (running Kubernetes in Docker): https://github.com/dajudge/kindcontainer

Read more comments on GitHub >

github_iconTop Results From Across the Web

Charts - Helm
Helm uses a packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources. A...
Read more >
13 Best Practices for using Helm - Coder Society
Take Your Helm Charts to the Next Level · 1. Take Advantage of the Helm Ecosystem · 2. Use Subcharts to Manage Your...
Read more >
Helm Charts Tutorial: The Kubernetes Package Manager ...
What Helm is; The most common use-cases of Helm; How to configure and ... is to install Docker and activate its Kubernetes cluster...
Read more >
Introduction to Kubernetes Helm Charts – BMC Software | Blogs
Ready to use Helm? Installing and configuring Helm for your K8S cluster is a very quick and straight forward process—there are multiple versions ......
Read more >
Introduction to Helm: Charts, Deployments, & More - Harness
More advanced features of Helm Charts are Chart Hooks and Chart Tests, which allow for interaction with a Release's lifecycle and the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found