You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Philipp Kraus <ph...@tu-clausthal.de> on 2022/06/06 03:38:58 UTC

Kubernetes Build Environment

Hello,

I need some idea how to solve this issue. I have got a MultiMaven project, which has got multiple web services. Each service will be run later in a container in Kubernetes.
I have found this plugin https://www.eclipse.org/jkube/docs/kubernetes-maven-plugin to build everything, but I would like to get integration testing within the Kubernetes environment,
Because all services has got a Kafka connection and I would like to run some complex integration test directly from the Maven build.

Can you give me some ideas how to do it?

Thanks a lot

Re: Kubernetes Build Environment

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Hello,

Well there are so many plugins, so I don’t know what would be enough. Hopefully somebody else would have a few recommendations.

And also starting test classes or groovy scripts from Maven Invoker could be considered pure Maven. However I would not say that credential management, workflows, orchestration and native applications are Mavens forté. And from my experience in this area you safe time and gain reliability/automation if you don’t try to force it into mavens structure.

BTW i just noticed that JKube really seems to have excellent APIs for stuff like building images, so thank you for the hint :) (i Wonder what part works without an docker daemon, will have to try this. Docker files are just not very flexible for things like repeatable builds and optimized layers (not even with builtkit - it seems)

Gruss
Bernd


--
http://bernd.eckenfels.net
________________________________
Von: Philipp Kraus <ph...@tu-clausthal.de>
Gesendet: Monday, June 6, 2022 7:47:34 PM
An: Maven Users List <us...@maven.apache.org>
Betreff: Re: Kubernetes Build Environment



> Am 06.06.2022 um 05:55 schrieb Bernd Eckenfels <ec...@zusammenkunft.net>:
>
> do you need to test K8s or just have some external containers to set up, maybe using Testcontainers with Docker APi is an alternative? (Advantage is you can simpler test it locally)

Yes I’m using TestContainers for some test, but here I would like to focus on a full test-case of the whole system, so interaction between all components

>
> Another alternative is to use a CI pipeline script/system instead of orchestrating it in maven - at least if there is no plugin which does what you need, instead from junit/testng (IT) test cases, using the kubernetes or f8 client might also be an option.

Yes this sound something what is possible, I would like to do some stress-testing with JMeter and also some integration testing, so I’m think about Kubernetes KinD within the CI pipeline. But so you would like to suggest to use Maven to build the artifact
And run it in a Kubernetes cluster via some CI pipeline scripts.

So based on your answer there is no pure Maven solution for this testing?

Thanks for the ideas

> ________________________________
> Von: Philipp Kraus <ph...@tu-clausthal.de>
> Gesendet: Monday, June 6, 2022 5:38:58 AM
> An: users@maven.apache.org <us...@maven.apache.org>
> Betreff: Kubernetes Build Environment
>
> Hello,
>
> I need some idea how to solve this issue. I have got a MultiMaven project, which has got multiple web services. Each service will be run later in a container in Kubernetes.
> I have found this plugin https://www.eclipse.org/jkube/docs/kubernetes-maven-plugin to build everything, but I would like to get integration testing within the Kubernetes environment,
> Because all services has got a Kafka connection and I would like to run some complex integration test directly from the Maven build.
>
> Can you give me some ideas how to do it?
>
> Thanks a lot


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org

Re: Kubernetes Build Environment

Posted by Philipp Kraus <ph...@tu-clausthal.de>.

> Am 06.06.2022 um 05:55 schrieb Bernd Eckenfels <ec...@zusammenkunft.net>:
> 
> do you need to test K8s or just have some external containers to set up, maybe using Testcontainers with Docker APi is an alternative? (Advantage is you can simpler test it locally)

Yes I’m using TestContainers for some test, but here I would like to focus on a full test-case of the whole system, so interaction between all components

> 
> Another alternative is to use a CI pipeline script/system instead of orchestrating it in maven - at least if there is no plugin which does what you need, instead from junit/testng (IT) test cases, using the kubernetes or f8 client might also be an option.

Yes this sound something what is possible, I would like to do some stress-testing with JMeter and also some integration testing, so I’m think about Kubernetes KinD within the CI pipeline. But so you would like to suggest to use Maven to build the artifact
And run it in a Kubernetes cluster via some CI pipeline scripts.

So based on your answer there is no pure Maven solution for this testing?

Thanks for the ideas

> ________________________________
> Von: Philipp Kraus <ph...@tu-clausthal.de>
> Gesendet: Monday, June 6, 2022 5:38:58 AM
> An: users@maven.apache.org <us...@maven.apache.org>
> Betreff: Kubernetes Build Environment
> 
> Hello,
> 
> I need some idea how to solve this issue. I have got a MultiMaven project, which has got multiple web services. Each service will be run later in a container in Kubernetes.
> I have found this plugin https://www.eclipse.org/jkube/docs/kubernetes-maven-plugin to build everything, but I would like to get integration testing within the Kubernetes environment,
> Because all services has got a Kafka connection and I would like to run some complex integration test directly from the Maven build.
> 
> Can you give me some ideas how to do it?
> 
> Thanks a lot


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org

Re: Kubernetes Build Environment

Posted by Lasse Lindqvist <la...@gmail.com>.
It is also possible you keep the test execution as part of the Maven
process/build.
In that case Exec Maven Plugin (
https://www.mojohaus.org/exec-maven-plugin/usage.html) will be a good
friend of yours.
There are some plugins that help you deploy to Kubernetes easily (Jkube and
some others). Once the services are up, you can run the test the way you
want (Surefire, Robot Framework whatever)
And after the tests tear down the services.

Maven actually has more lifecycles phases than most know (
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html)
Important for you might be the pre-integration-test (setup Kubernetest
here) and post-integration-test (tear down resources here). Just make sure
the test script itself will not fail the build and that the build failing
is done in verify phase after tear down. Otherwise it becomes costly
quickly.

ma 6. kesäk. 2022 klo 7.57 David Karr (davidmichaelkarr@gmail.com)
kirjoitti:

> Along the lines of Bernd's response, I would (as we have done in our own
> builds) use Maven to build the artifacts that we deploy to our intranet
> repositories, but we do everything else in Jenkins pipeline script. We just
> call "kubectl" for k8s configuration steps, and when it comes down to
> integration tests, we do stil use Maven Failsafe, but we supply the
> host:port of the service in the cluster on the maven command line.
>
> On Sun, Jun 5, 2022 at 8:55 PM Bernd Eckenfels <ec...@zusammenkunft.net>
> wrote:
>
> > do you need to test K8s or just have some external containers to set up,
> > maybe using Testcontainers with Docker APi is an alternative? (Advantage
> is
> > you can simpler test it locally)
> >
> >  Another alternative is to use a CI pipeline script/system instead of
> > orchestrating it in maven - at least if there is no plugin which does
> what
> > you need, instead from junit/testng (IT) test cases, using the kubernetes
> > or f8 client might also be an option.
> >
> > Gruss
> > Bernd
> >
> >
> > --
> > http://bernd.eckenfels.net
> > ________________________________
> > Von: Philipp Kraus <ph...@tu-clausthal.de>
> > Gesendet: Monday, June 6, 2022 5:38:58 AM
> > An: users@maven.apache.org <us...@maven.apache.org>
> > Betreff: Kubernetes Build Environment
> >
> > Hello,
> >
> > I need some idea how to solve this issue. I have got a MultiMaven
> project,
> > which has got multiple web services. Each service will be run later in a
> > container in Kubernetes.
> > I have found this plugin
> > https://www.eclipse.org/jkube/docs/kubernetes-maven-plugin to build
> > everything, but I would like to get integration testing within the
> > Kubernetes environment,
> > Because all services has got a Kafka connection and I would like to run
> > some complex integration test directly from the Maven build.
> >
> > Can you give me some ideas how to do it?
> >
> > Thanks a lot
> >
>

Re: Kubernetes Build Environment

Posted by David Karr <da...@gmail.com>.
Along the lines of Bernd's response, I would (as we have done in our own
builds) use Maven to build the artifacts that we deploy to our intranet
repositories, but we do everything else in Jenkins pipeline script. We just
call "kubectl" for k8s configuration steps, and when it comes down to
integration tests, we do stil use Maven Failsafe, but we supply the
host:port of the service in the cluster on the maven command line.

On Sun, Jun 5, 2022 at 8:55 PM Bernd Eckenfels <ec...@zusammenkunft.net>
wrote:

> do you need to test K8s or just have some external containers to set up,
> maybe using Testcontainers with Docker APi is an alternative? (Advantage is
> you can simpler test it locally)
>
>  Another alternative is to use a CI pipeline script/system instead of
> orchestrating it in maven - at least if there is no plugin which does what
> you need, instead from junit/testng (IT) test cases, using the kubernetes
> or f8 client might also be an option.
>
> Gruss
> Bernd
>
>
> --
> http://bernd.eckenfels.net
> ________________________________
> Von: Philipp Kraus <ph...@tu-clausthal.de>
> Gesendet: Monday, June 6, 2022 5:38:58 AM
> An: users@maven.apache.org <us...@maven.apache.org>
> Betreff: Kubernetes Build Environment
>
> Hello,
>
> I need some idea how to solve this issue. I have got a MultiMaven project,
> which has got multiple web services. Each service will be run later in a
> container in Kubernetes.
> I have found this plugin
> https://www.eclipse.org/jkube/docs/kubernetes-maven-plugin to build
> everything, but I would like to get integration testing within the
> Kubernetes environment,
> Because all services has got a Kafka connection and I would like to run
> some complex integration test directly from the Maven build.
>
> Can you give me some ideas how to do it?
>
> Thanks a lot
>

Re: Kubernetes Build Environment

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
do you need to test K8s or just have some external containers to set up, maybe using Testcontainers with Docker APi is an alternative? (Advantage is you can simpler test it locally)

 Another alternative is to use a CI pipeline script/system instead of orchestrating it in maven - at least if there is no plugin which does what you need, instead from junit/testng (IT) test cases, using the kubernetes or f8 client might also be an option.

Gruss
Bernd


--
http://bernd.eckenfels.net
________________________________
Von: Philipp Kraus <ph...@tu-clausthal.de>
Gesendet: Monday, June 6, 2022 5:38:58 AM
An: users@maven.apache.org <us...@maven.apache.org>
Betreff: Kubernetes Build Environment

Hello,

I need some idea how to solve this issue. I have got a MultiMaven project, which has got multiple web services. Each service will be run later in a container in Kubernetes.
I have found this plugin https://www.eclipse.org/jkube/docs/kubernetes-maven-plugin to build everything, but I would like to get integration testing within the Kubernetes environment,
Because all services has got a Kafka connection and I would like to run some complex integration test directly from the Maven build.

Can you give me some ideas how to do it?

Thanks a lot